Skip to content

Instantly share code, notes, and snippets.

View jbeard4's full-sized avatar

Jacob Beard jbeard4

View GitHub Profile
@jbeard4
jbeard4 / gist:853745
Created March 3, 2011 22:23
enterStates and addStatesToEnter specification
procedure enterStates(enabledTransitions):
statesToEnter = new OrderedSet()
statesForDefaultEntry = new OrderedSet()
for t in enabledTransitions:
if t.target:
LCA = findLCA([t.source].append(getTargetStates(t.target)))
addStatesToEnter(getTargetStates(t.target),LCA,statesToEnter,statesForDefaultEntry)
if isParallelState(LCA):
@jbeard4
jbeard4 / gist:850188
Created March 2, 2011 00:12
test case 2
<scxml xmlns="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="scxmlRoot">
<initial>
<transition target="P"/>
</initial>
<parallel id="P">
<history id="H" type="deep"/>
<state id="A" initial="A1">
<state id="A1">
@jbeard4
jbeard4 / gist:850186
Created March 2, 2011 00:11
test case 1
<scxml xmlns="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="scxmlRoot">
<initial>
<transition target="A2 B2"/>
</initial>
<parallel id="P">
<state id="A" initial="A1">
<state id="A1"/>
@jbeard4
jbeard4 / gist:849856
Created March 1, 2011 20:44
procedure addStatesToEnter
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:
<scxml initial="p">
<parallel id="p">
<history id="h">
<transition target="A.2 B.2"/>
</history>
<state id="A" initial="A.1">
<state id="A.1"/>