Completion Events are standard UML Events which are fired during the execution of a State Machine diagram. For composite or submachine States, a completion Event will be generated when all internal Activities, e.g., entry and doActivity Behaviors, have completed execution under either of the following circumstances

  • If the State is a composite State, all its orthogonal Regions have reached a FinalState.
  • if the State is a submachine State, the submachine StateMachine execution has reached a FinalState.
     

TIP

You can enable/disable the Completion Events and Transitions option in the SCXML Engine group in the Project Options dialog for completion Events and Transitions support.

The Completion Events and Transitions option in the SCXML Engine group in the Project Options dialog.

Case 1

Completion events and Transitions in a state machine diagram
Completion Events and Transitions in a State Machine diagram.

For example, in the above State Machine diagram, a Transition from the "on" State to the "off" State does not happen until a completion Event is generated. The completion Event is generated after the DoActivity Behavior completes and only then the State transits from "on" to "off".

Case 2

Completion Events and Transitions in a state machine diagram
Completion Events and Transitions in a State Machine diagram.

In the above State Machine diagram, a completion Event is generated after the entry and sendOff Behaviors have completed.

Case 3

Completion Events and Transitions in a state machine diagram
Completion Events and Transitions in a State Machine diagram.

In the above State Machine diagram, a completion Event will be generated after the entry and working Behaviors have completed.

Information

Completion Events have dispatch priority over all other Events. They are put into the beginning of the Event queue.