Contents | Overview | Examples | Editor | Forum |
---|
Allows a state machine to remember its state configuration. A <transition> taking the <history> state as its target will return the state machine to this recorded configuration.
If the 'type' of a <history> element is 'shallow', the SCXML processor must record the immediately active children of its parent before taking any transition that exits the parent.
<history type="shallow"/>
Example:
Active states: Airplane, Engines, Left, Right, LeftOn, RightOn
Active state: Expecting
Active states: Airplane, Engines, Left, Right, LeftOff, RightOff
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Airplane" initial="HistoryPoint">
<transition event="Pause" target="Expecting"/>
<parallel id="Engines">
<transition event="NoFuel" target="Refuel"/>
<state id="Left" initial="LeftOff">
<state id="LeftOff">
<transition event="Startup.Left" target="LeftOn"/>
</state>
<state id="LeftOn">
<transition event="Shutdown.Left" target="LeftOff"/>
</state>
</state>
<state id="Right" initial="RightOff">
<state id="RightOff">
<transition event="Startup.Right" target="RightOn"/>
</state>
<state id="RightOn">
<transition event="Shutdown.Right" target="RightOff"/>
</state>
</state>
</parallel>
<initial>
<transition target="HistoryPoint"/>
</initial>
<history id="HistoryPoint">
<transition target="Refuel"/>
</history>
<state id="Refuel">
<transition event="Finished" target="Engines"/>
</state>
</state>
<state id="Expecting">
<transition event="Resume" target="HistoryPoint"/>
</state>
</scxml>
If the 'type' of a <history> element is 'deep', the SCXML processor must record the active atomic descendants of the parent before taking any transition that exits the parent.
<history type="deep"/>
Active states: Airplane, Engines, Left, Right, LeftOn, RightOn
Active state: Expecting
Active states: Airplane, Engines, Left, Right, LeftOn, RightOn
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Airplane">
<transition event="Pause" target="Expecting"/>
<initial>
<transition target="HistoryPoint"/>
</initial>
<history id="HistoryPoint" type="deep">
<transition target="Refuel"/>
</history>
<parallel id="Engines">
<transition event="NoFuel" target="Refuel"/>
<state id="Left" initial="LeftOff">
<state id="LeftOff">
<transition event="Startup.Left" target="LeftOn"/>
</state>
<state id="LeftOn">
<transition event="Shutdown.Left" target="LeftOff"/>
</state>
</state>
<state id="Right" initial="RightOff">
<state id="RightOff">
<transition event="Startup.Right" target="RightOn"/>
</state>
<state id="RightOn">
<transition event="Shutdown.Right" target="RightOff"/>
</state>
</state>
</parallel>
<state id="Refuel">
<transition event="Finished" target="Engines"/>
</state>
</state>
<state id="Expecting">
<transition event="Resume" target="HistoryPoint"/>
</state>
</scxml>
Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST behave as if the transition had taken the default stored state configuration as its target.
Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST execute any executable content in the transition after the parent state's onentry content and any content in a possible initial transition.
It follows from the semantics of history states that they never end up in the state configuration.
After the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST behave as if the transition had taken the stored state configuration as its target.
TOP | Contents | Overview | Examples | Editor | Forum |
---|