State machine diagram

State machine diagrams show which states a system can take on, the relationships between them, and which events trigger the relevant state transitions. A State machine diagram represents a state machine. The states and their transitions are parts of this state machine.

The state machine can describe the behavior of a class, the behavior of another classifier of the UML type BehavioredClassifier, or the behavior of an operation. However, it can describe a behavior very generally without relating to one of these elements.

Order states state machine diagram

Figure 22 shows the states of an order. While the Timing diagram from Figure 20 only shows a sequence of state transitions, the State machine diagram includes the entire state machine with all states and their possible transitions as graphical edges, which link the states to one another.

The first state that an order can have is the new state. When this state occurs, the order items are recorded (entry property of the UML type State). An availability check for the items in the order items completes the state (exit property of the UML type State).

If a text is displayed in square brackets on a state transition, it refers to the condition (guard property of the UML type Transition) that has to be met for the state transition to occur. In the example diagram, these are the two conditions [Items are available] and [Items are not available].

The text that follows the / character at a state transition refers to a behavior that is triggered by the state transition (effect property of the UML type Transition). In the example diagram, this would be release, reject, and deliver.

If a text at a state transition is neither in square brackets nor after a slash, it is the trigger of the state transition (trigger property of the UML type Transition). In the example diagram, these are the two texts that start with the word when. The keyword when means that the triggers are assigned events of the UML type ChangeEvent (event property of the UML type Trigger).