def _CreateTrans(self, trans, transaction): if not isinstance(transaction, int): perror("Nested transactions are not permited") transsetup = toStringList(trans) # Static format startstate = StateNode(transsetup[1], self.Accesses) if len(transsetup) > 3: finalstate = StateNode(transsetup[3], self.Accesses) else: finalstate = StateNode(self.State, self.Accesses) transaction = Transaction(startstate, transsetup[2], finalstate) return transaction
def _SetTransGuard(self, node, transaction): guardtype = node.getChild(0).toString() guardmsg = Message(guardtype) if not list(filter(lambda x: guardtype == x, self.msgTypes)): self.msgTypes.append(guardtype) # Append new transition to tree (When is always succeded by a guard prenode = transaction.getcurtransitionode() startstate = transaction.getcurtransition().getfinalstate() finalstate = StateNode(transaction.getinterfinalstate(), self.Accesses) transaction.newwhen(startstate, finalstate, guardmsg, prenode) return transaction
def __init__(self, startstate: StateNode, guard: str, finalstate: StateNode): assert isinstance(startstate, StateNode) assert isinstance(finalstate, StateNode) assert isinstance(guard, str) self.messages = {} self.trans: List[Transition] = [] self.startState = startstate self.interfinalState = finalstate.getstatename() self.access = guard self.TransTree = ForkTree() self.ifTree = 0 self.TransTree.insertnode(Transition(startstate, finalstate, guard)) self.IfTree = ForkTree()