|On this page…|
A state becomes active in one of these ways:
An incoming transition crosses state boundaries.
An incoming transition ends at the state boundary.
It is the parallel state child of an active state.
A state performs its entry action (if specified) when it becomes active. The state becomes active before its entry action executes and completes.
The execution steps for entering a state are as follows:
Parallel (AND) states are ordered for entry based on whether you use explicit ordering (default) or implicit ordering. For details, see Explicit Ordering of Parallel States and Implicit Ordering of Parallel States.
If the state contains a history junction and there is an active child of this state at some point after the most recent chart initialization, perform the entry actions for that child. Otherwise, execute the default flow paths for the state.
If this state has children that are parallel states (parallel decomposition), perform entry steps 1 through 5 for each state according to its entry order.
If this state has only one child substate, the substate becomes active when the parent becomes active, regardless of whether a default transition is present. Entering the parent state automatically makes the substate active. The presence of any inner transition has no effect on determining the active substate.
When states become active, they perform the following execution steps:
Execute the set of outer flow charts (see Order of Execution for a Set of Flow Charts).
If this action causes a state transition, execution stops.
If this action does not cause a state transition, the active children execute, starting at step 1. Parallel states execute in the same order that they become active.
A state becomes inactive in one of these ways:
An outgoing transition originates at the state boundary.
An outgoing transition crosses the state boundary.
It is a parallel state child of an activated state.
A state performs its exit actions before becoming inactive.
The execution steps for exiting a state are as follows:
Sibling parallel states exit starting with the last-entered and progress in reverse order to the first-entered. See step 2 of Steps for Entering a State.
The following example shows how active and inactive states respond to events.
Inactive charts respond to events as follows:
A valid default transition to state A exists.
Sleeping charts respond to events as follows:
State A is active from the preceding steps 1 through 5.