Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save neilmanuell/874273 to your computer and use it in GitHub Desktop.
Save neilmanuell/874273 to your computer and use it in GitHub Desktop.
New xml declaration incorporating command guards for robotLegs/signal flavoured (as3)statemachine
<!-- Root declaration unchanged -->
<fsm initial="starting">
<!--
State declaration with unique name.
The phase signal attribute declarations have been migrated to child elements.
-->
<state name="starting">
<!-- Declaration for enteringGuard signal -->
<enteringGuard>
<!--
Declaration for a command class, the class path attribute describes its value.
This can either be the name or the fully qualified path.
Multiple commands can be declared (but no duplications) and will be executed in the
order of their declaration
-->
<commandClass classPath="SampleCommandA"/>
<commandClass classPath="SampleCommandB">
<!--
Declaration for a guard class, guarding the parent command class.
Multiple guards may be defined
-->
<guardClass classPath="HappyGuard"/>
<guardClass classPath="HappyGuard"/>
<guardClass classPath="GrumpyGuard"/>
</commandClass>
</enteringGuard>
<!-- Declaration for entered signal -->
<entered>
<commandClass classPath="SampleCommandC"/>
<commandClass classPath="SampleCommandD" fallback="SampleCommandE">
<guardClass classPath="GrumpyGuard"/>
<guardClass classPath="HappyGuard"/>
<guardClass classPath="SneezyGuard"/>
</commandClass>
</entered>
<!-- Declaration for exitingGuard signal -->
<exitingGuard>
<commandClass classPath="SampleCommandA">
<guardClass classPath="SleepyGuard"/>
<guardClass classPath="HappyGuard"/>
</commandClass>
</exitingGuard>
<!-- Declaration for tearDown signal -->
<tearDown>
<commandClass classPath="SampleCommandC"/>
</tearDown>
<!-- Declaration for cancelled signal -->
<cancelled>
<commandClass classPath="SampleCommandC"/>
</cancelled>
<!-- Declaration for transition unchanged -->
<transition action="next" target="navigating"/>
</state>
</fsm>
@neilmanuell
Copy link
Author

All classes referenced will, as in the older version, need to be added to the SignalFSMInjector using the (renamed) addClass() method.

@neilmanuell
Copy link
Author

Added fallbackCommand attribute.
These will not be legal in the enteringGuard, exitingGuard and cancelled phases of the transitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment