SCXML-tutorial

Contents Overview Examples Editor Forum

<final>

Video version

Represents a final state of an <scxml> or compound <state> element.

final

<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
	<state id="Work">
		<transition event="done.state.Work" target="WorkFinished"/>
		<state id="CompletingTask">
			<transition target="Completed"/>
		</state>
		<final id="Completed"/>
	</state>
	<final id="WorkFinished"/>
</scxml>

After entering the initial configuration, and after executing each microstep, the SCXML Processor must check the state configuration for <final> states that it has entered during the microstep. If it has entered a <final> state that is a child of <scxml>, it must halt processing. If it has entered a <final> state that is a child of a compound state, it must generate the event done.state.id, where id is the id of the compound state. If the compound state is itself the child of a <parallel> element, and all the <parallel> element's other children are in final states, the Processor must generate the event done.state.id, where id is the id of the <parallel> elements.

join_regions

<scxml name="ScxmlJoinParallel" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
	<parallel id="p">
		<transition event="done.state.p" target="someOtherState"/>
		<state id="S1" initial="S11">
			<state id="S11">
				<transition event="e4" target="S12"/>
			</state>
			<state id="S12">
				<transition event="e1" target="S1Final"/>
			</state>
			<final id="S1Final"/>
		</state>
		<state id="S2" initial="S21">
			<state id="S21">
				<transition event="e1" target="S22"/>
			</state>
			<state id="S22">
				<transition event="e2" target="S2Final"/>
			</state>
			<final id="S2Final"/>
		</state>
	</parallel>
	<state id="someOtherState"/>
</scxml>

W3C IRP tests

1. Test 372

When the state machine enters the final child of a state element, the SCXML processor MUST generate the event done.state.id after completion of the onentry elements, where id is the id of the parent state.

test372

2. Test 570

Immediately after generating done.state.id upon entering a final child of state, if the parent state is a child of a parallel element, and all of the parallel's other children are also in final states, the Processor MUST generate the event done.state.id where id is the id of the parallel element.

test570

TOP Contents Overview Examples Editor Forum