Exemple #1
0
def targetDeal(inputfile):
    f = open(inputfile, 'r')
    targetList = []
    targetList = f.readlines()
    f.close()
    k = 0
    for item in targetList:
        s.append(item.split(', '))
        #需要修改成<name, src,tgt,event,cond,action>
        src = SM.state(s[k][1])
        tgt = SM.state(s[k][2])
        targetbranchlist.append(
            EFSM.Transition(s[k][0], src, tgt, s[k][3], s[k][4], s[k][5]))
        k += 1
Exemple #2
0
for block in SMBlockList:

    if block[0] == 'Transition':
        print([item[1] for item in SMBlockList])
        print('----------------')
        (name, srcName, tgtName, event, cond,
         action) = [item[1] for item in block[1]]

        if srcName != '':  # old code is !=''
            src = SM.state(srcName)
        if tgtName != '':
            tgt = SM.state(tgtName)

        print(name, srcName, tgtName, event, cond, action)
        targetbranchlist.append(
            EFSM.Transition(name, src, tgt, event, cond, action))

# for item in targetList:
#     s.append(item.split(', '))
#     print s
#     #需要修改成<name, src,tgt,event,cond,action>
#     src = SM.state(s[k][1])
#     tgt = SM.state(s[k][2])
#     targetbranchlist.append(EFSM.Transition(s[k][0], src, tgt, s[k][3], s[k][4], s[k][5]))
#     k+=1
f.close()


def targetBranch():
    return targetbranchlist[-1]
Exemple #3
0
targetList = []
targetList = f.readlines()
f.close()
s = []
k = 0
targetbranchlist = []
if targetList:
    for item in targetList:
        s.append(item.split(', '))
        print(s)
        #需要修改成<name, src,tgt,event,cond,action>
        src = SM.state(s[k][1])
        tgt = SM.state(s[k][2])
        print(s[k][0], src, tgt, s[k][3], s[k][4], s[k][5])
        targetbranchlist.append(
            EFSM.Transition(s[k][0], src, tgt, s[k][3], s[k][4], s[k][5]))
        k += 1


def targetBranch():
    return targetbranchlist[0]


def change():
    targetbranchlist.pop(0)


def sort():
    targetbranchlist.append(targetbranchlist[0])
    targetbranchlist.remove(targetbranchlist[0])