Created
March 1, 2011 20:44
-
-
Save jbeard4/849856 to your computer and use it in GitHub Desktop.
procedure addStatesToEnter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure addStatesToEnter(s,root,statesToEnter,statesForDefaultEntry): | |
if isHistoryState(s): | |
if historyValue[s.id]: | |
for s0 in historyValue[s.id]: | |
addStatesToEnter(s0,getParent(s),statesToEnter,statesForDefaultEntry) | |
else: | |
for t in s.transition: | |
for s0 in getTargetStates(t.target): | |
addStatesToEnter(s0,getParent(s),statesToEnter,statesForDefaultEntry) | |
else: | |
statesToEnter.add(s) | |
if isParallelState(s): | |
for child in getChildStates(s): | |
addStatesToEnter(child,s,statesToEnter,statesForDefaultEntry) | |
elif isCompoundState(s): | |
statesForDefaultEntry.add(s) | |
for tState in getTargetStates(s.initial): | |
addStatesToEnter(tState, s, statesToEnter, statesForDefaultEntry) | |
for anc in getProperAncestors(s,root): | |
statesToEnter.add(anc) | |
if isParallelState(anc): | |
for pChild in getChildStates(anc): | |
if not statesToEnter.toList().some(lambda s2: isDescendant(s2,pChild)): | |
addStatesToEnter(pChild,anc,statesToEnter,statesForDefaultEntry) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment