Next, add entry Behaviors to the ready and running States of the StopWatch State Machine.
To add an entry Behavior to the ready State
- Right click on the ready state in the StopWatch State Machine diagram and select Specification to open the State's Specification window.
- Click the Categorized View button to open the properties of the State in the categorized view (see the following figure).
- In the Entry category, click on Behavior Type and select OpaqueBehavior (see the following figure). A new Opaque Behavior will be created as the entry Behavior of the ready State.
- Click Close to close the Specification window. The ready State will have an empty entry Behavior, as shown in the figure below.
- Click on the entry Behavior in the ready State and, in the Alf editor window, type the Alf code shown in the figure below.
- When the code is correct, click on OK. The Alf code should now appear in the entry Behavior for the ready State, as shown in the figure below.
To add an entry Behavior to the running State
- Right click on the running state in the StopWatch State Machine diagram and select Specification to open the state's Specification window.
- Click the Categorized View button to open the properties of the State in the categorized view.
- In the Entry category, click on Behavior Type and select OpaqueBehavior to create a new Opaque Behavior as the entry Behavior of the running state.
- Click Close to close the Specification window.
Click on the entry Behavior in the running State and, in the Alf editor window, type the Alf code shown in the figure below.
When the code is correct, click Save. The Alf code should now appear in the entry Behavior for the running State, as shown in the figure below.
At this point the StopWatch has been completely modeled. You can now execute the StopWatch Class using Magic Model Analyst.
Related pages