Reporting a State Machine

The Execution Analyzer can record a sequence diagram , we know that. What you might not know, is that it can use a State Machine at the same time to detect State transitions that may 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.


Firstly you model a State Machine 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_strColour ==  "Blue"

You then use the Recorder window to launch the debugger.

The Recorder window Run button is different from the button on other debugger toolbars.

The Recorder window will allow you to browse for a State Machine if you do not know the State Machine name. The 'State Transition' dialog presents a list of State Machines 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.


The Stations State Machine 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 State Machine.

The Stations State Machine 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 Sub Machine and diagram; no other model components are listed.

Learn more