Modeling object behavior by using
state machine diagrams
You can use state machine
diagrams to illustrate the behavior of classes, collaborations, components,
nodes, operations, use cases, or entire systems.
Creating state machines
You can create state machines
to describe objects that have complicated or significant behavior.
When you create a state machine, a single diagram and a region are
created by default. A region is the container that holds the states
and transitions that you add to the diagram to graphically describe
the behavior of an object. You can create a state machine for classes,
components, and operations.
Adding diagrams to state machines
A state machine diagram opens
when you create a state machine. You can create a state machine diagram
for classes, collaborations, components, nodes, and use cases.
Adding regions to state machine diagrams
In UML state machine diagrams,
a region is a container inside a state that can hold states, pseudostates,
and transitions, which you can add to state machines or states. You
can use regions to define nested states and transitions. Regions allow
you to provide more detail about the internal transitions of a particular
state.
Displaying the compartment titles of states
In UML state machine diagrams,
states are divided into compartments. You can display the action and
region compartment titles of states.
Creating transitions between states
In UML modeling, you can
add transitions to a state machine diagram to show how an object changes
state. A trigger, a guard condition, and an effect are the three optional
parts of a transition. Add a trigger to a transition to show that
an event must occur for a transition to initiate. Add a guard condition
to a transition to show that a particular Boolean condition must be
true for a transition to occur. Add an effect to a transition to show
that an object performs a particular activity when a guard condition
is satisfied.
Removing states from a composite state
In UML modeling, you can
remove states from a composite state by dividing the composite state
into its individual states. The composite state is removed from the
state machine and replaced with the states that the composite state
contained.
Adding entry, do, and exit activities to states In UML models, you can add an
entry, do, or exit activity to a state to describe an activity that
is performed only upon entry into a state, exit out of a state, or
that is ongoing in a particular state.