Advanced State Diagrams
To be flexible and powerful, the UML allows you to
put one or more state diagrams inside a single state to indicate that
when an element is in that state, other elements inside of it have
their own states. For example, within the Active
state of the project management system, each object and subsystem has
its own state, and the state diagram for each element may be shown
inside the Active state of the project management
system or by using the element’s own state diagram.
This recursive nature of state diagrams is very powerful, because it
allows you to learn the basic notation of state diagrams and reapply
it to nested state diagrams without having to learn more notation.
In the UML, a state may be shown as a rectangle with rounded corners
and three compartments separated by horizontal solid lines. Figure 7-5 shows the Active state of
the project management system with three compartments. The top
compartment of a state contains the name of the state or a
description of the situation of the element.
The middle compartment of a state may contain transitions for the following special events:
-
entry Indicates the action to be performed when the element enters the state
-
exit Indicates the action to be performed when the element exits the state
-
do Indicates the action to be performed continuously while the element is in the state
Figure 7-5 shows that when the project management
system enters the Active state, a message is
logged using the LogMessage action. When ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access