Next, we are going to create an increased Activity, which will be called when the running State is reached. To add the Activity to the running State, follow the same steps used to create the reset Activity for the entry to the ready State.

To add an Increase Activity to the entry to the running State


  1. Right-click the running State on the StopWatch State Machine diagram and select Specification to open the State's Specification window.
  2. Select the Entry row and click the button. A context menu will open. Select Activity to add a new Activity to the Entry to the running State.
  3. Name the created Activity "increase".
  4. Click Close to close the Specification window. The increase Activity will be added to the entry to the running State on the StopWatch State Machine diagram as shown in the following figure

    Adding the Increase Activity to the Entry of the Running State

  5. Add an Activity diagram to the created increase Activity and use the default name, which is "increase".
  6. Add a CallBehaviorAction to the increaseTime Activity on the increase Activity diagram by dragging the increaseTime Activity from the containment browser to the increase Activity diagram.
  7. Add an Initial stage and a Final Activity stage to the increase Activity diagram and connect the two stages and the increaseTime action with ControlFlow, which is on the Activity Diagram toolbar. 

    A Complete Model of the Increase Activity


At this point, the StopWatch has been completely modeled. You can now execute the StopWatch class using Cameo Simulation Toolkit.