Click or drag to resize
StaMaRevert a Composite State Back to a Basic State When Using StaMa Visio Shapes

Explains how to convert the visual representation of a composite state back to a simple state.

During refactoring a state machine it might happen that a composite state shall be reverted to a simple state. If multiple transitions end at the state or the state contains a complex sub-region, it may sometimes be desirable to deconstruct the composite state.

The main point for deconstructing is that there is no easy way to remove an entire region or multi-selection of shapes from a composite state. In case the states within the sub-region are to be reused, the easiest way is to drag the individual states from the sub-region to another region and then delete the obsolete empty sub-region. Semantically and for code generation purposes the empty composite state will work like a simple state, however the visual representation is inappropriate as it still looks like a composite state.

The following procedures show how to appropriately disassemble a composite state as shown in Figure 1.

Refactoring Initial
Figure 1: Starting point for refactoring a composite state

Removing the contents of a composite state

  1. Select the first state of the sub-region and drag it outside the sub-region.

    Refactoring Drag StateA
    Figure 2: Drag a single state out of a sub-region

    Drop the state over an unused area.

    Refactoring Drop StateA
    Figure 3: Drop the state
  2. Repeat the above steps for all other states of the sub-region.

    Refactoring Drag StateB
    Figure 4: Drag other state out of the sub-region
    Refactoring Drop StateB
    Figure 5: Drop the state
  3. Select the sub-region group container by clicking onto the region order rectangle.

    Refactoring Sub Region Selected
    Figure 6: Sub-region selected

    Delete the sub-region group container.

    Refactoring Sub Region Deleted
    Figure 7: Sub-region deleted
  4. Reduce the size of the composite state below the size of the state name label and execute Convert to Simple State from the context menu of the state shape.

    Refactoring Convert To Simple State
    Figure 8: Composite state reverted to simple state
See Also

Other Resources