States, regions, and transitions
States
A state can contain other states, often called as nested states or substates. If you are modeling complex state machines, use nested states to separate detailed behavior into multiple levels. States can also contain actions that identify the tasks that can occur when an object is in a particular state.
State types and regions
Every
state is divided into compartments. The top compartment displays the name
of the state. The compartment below the name compartment is the action compartment.
The action compartment displays the do, entry, or exit activities that the
state may contain. Each compartment below the activities compartment represents
a region. State machines, composite states, and orthogonal states contain
regions. A region can contain states, pseudostates, and transitions. Use regions
to define nested states and transitions.
| State type | Description | Diagram element |
|---|---|---|
| Simple | A state with no regions | |
| Composite | A state with one region | |
| Orthogonal | A state with two or more regions | ![]() |
| Final | A state that is placed in the region of a composite state to indicate that the activity in the region is complete | |
| Submachine state | A state that references another state machine |
Transitions
A transition shows a path between states that indicates that a change of state is occurring. A trigger, a guard condition, and an effect are the three parts of a transition, all of which are optional.
A trigger is an event that must occur for
a transition to start. A guard condition is a Boolean condition that must
be true for a transition to occur. An effect is an action or activity that
the object performs when a guard condition is satisfied.
| Event type | Description |
|---|---|
| Call | An object receives a request to invoke an operation. The invocation of the operation triggers a transition. |
| Change | A Boolean condition is specified that triggers a transition when the condition is true. |
| Signal | A specified message that, when received by an object, triggers a transition. |
| Time | A specified period of time that must pass or an absolute time that triggers a transition. |
