Prev | Next |
Reporting a StateMachine
The Execution Analyzer can record a Sequence diagram, we know that. What you might not know is that it can use a StateMachine at the same time to detect State transitions that might occur along the way. These States are represented at the point in time on the lifeline of the object. The transitions also are apparent from the lifelines. Any invalid or illegal transition will be highlighted with a red border. Have a look.
Process
Firstly you model a StateMachine for the appropriate Class element.
You then compose the expressions that define each State using the 'Constraints' tab of each State.
These simple expressions are formed using attribute names from Class model and actual code base. They are not OCL statements. Each expression should appear on a separate line.
m_strColor == "Blue"
You then use the Recorder window to launch the debugger.
The Recorder window is different from the button on other debugger toolbars.
The Recorder window will allow you to browse for a StateMachine if you do not know the StateMachine name. The 'State Transition' dialog presents a list of StateMachines for the entire model, in which you locate and select the appropriate diagram (see the example).
When you generate the Sequence diagram, it depicts not only the sequence but changes in State at the various points in the sequence; each Class instance participating in the detection process is displayed with its own lifeline.
Example
The Stations StateMachine shows the different States within the Melbourne Underground Loop subway system.
A train traveling on the subway network can be stopped at any of the stations represented on the StateMachine.
The Stations StateMachine is a child of the CTrain Class.
When you browse for the diagram in the 'State Transition Recorder' dialog, the hierarchy shows only the root Package, parent Class and child SubMachine and diagram; no other model components are listed.
Learn more