A statechart diagram is a view of a state machine that models the changing behavior of a state. Statechart diagrams show the various states that an object goes through, as well as the events that cause a transition from one state to another.
Statechart diagram model elements
The common model elements that statechart diagrams contain are:
States
Start and end states
Transitions
Entry, do, and exit actions
A state represents a condition during the life of an object during which it satisfies some condition or waits for some event. Start and end states represent the beginning or ending of a process. A state transition is a relationship between two states that indicates when an object can move the focus of control on to another state once certain conditions are met. In a statechart diagram, a transition to self element is similar to a state transition. However, it does not move the focus of control. A state transition contains the same source and target state.
Actions in a Statechart diagram
Each state on a statechart diagram can contain multiple internal actions. An action is best described as a task that takes place within a state. There are four possible actions within a state:
On entry
On exit
Do
On event
Creating a statechart diagram in Rational Rose
A statechart diagram is usually placed under the Logical View package. Right-click on the Logical View package and select New>Statechart Diagram to create a Statechart Diagram. Name your diagram and then double-click on the name to open the diagram work area.
States
Place the start state, , end state, , and states, , on the diagram work area by selecting the respective icon from the diagram toolbox and then clicking on the work area at the point where you want to place the states.
To name the states, double-click on the state. This action will bring up the State Specification dialog box. In the General tab, type the name of your state in the Name text box.
Actions
To add an action to a state, select the Actions tab in the State Specification dialog box, right-click anywhere in the white area and select Insert from the shortcut menu. An action will be automatically placed. Double-click the action item to bring up the Action Specification dialog box. Select an action from the When drop-down list box. Type the action description in the Name field. Click OK and then click OK again to exit the State Specification dialog box.
Transitions
To create a transition to self , click the icon and then click on the state. To create transitions between the states, click the icon and then click on the first state and drag and release on the next state.
To name the transitions, double-click on the transition to bring up the State Transition Specification dialog box. Type the name or label in the Event text box and click OK.
Figure 1. shows a Statechart Diagram depicting the various elements of a state machine.
Figure 1. A state machine
The name of the diagram itself clarifies the purpose of the diagram and ...