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 is generated under the following circumstances:
- When all internal activities (e.g., entry and doActivity Behaviors) have completed execution, and
- If the State is a composite State, all its orthogonal Regions have reached a FinalState, or
- if the State is a submachine State, the submachine StateMachine execution has reached a FinalState.
Case 1:
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:
In the above state machine diagram, a completion event is generated after the entry and sendOff behaviors have completed.
Case 3:
In the above state machine diagram, a completion event will be generated after the entry and working behaviors have completed.