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 add diagrams to a state machine to describe different behavioral aspects of an object. You can create a state machine diagram for classes, collaborations, components, nodes, and use cases.
Adding regions to state machines and states
In UML modeling, a region is a container that holds states, pseudostates, and transitions. You can add a region to a state machine or a state. You can use regions to define nested states and transitions.
Changing the edit settings on regions
Changes made to a region in the Model Explorer view are reflected in the diagrams owned by the same state machine and changes made to a region in the diagram editor are reflected in the Model Explorer view. You can set the canonical properties value of a region to false so that changes made to a region in the Model Explorer view are not reflected in the corresponding state machine diagrams and so that a region can be edited independently of other diagrams in the same state machine.
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 modeling, 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.