Creating a State Invariant - UML 2.0

From RAD Studio
Jump to: navigation, search

Go Up to Interaction Diagram Procedures

This topic explains how to create a state invariant.

To create a state invariant as an OCL comment:

  1. On the UML 2.0 Sequence Diagram Tool Palette, choose the State Invariant button.
  2. Click the target lifeline or execution specification.

    Tip: Alternatively, use the Add State invariant command on the context menu of a lifeline or an execution specification.

  3. In the Object Inspector of the state invariant, select the General node.
  4. In the Invariant kind field, choose OCL expression from the drop-down list. The shape of the state invariant diagram element changes to braces.
  5. In the OCL invariant node that adds to the Object Inspector, select the language of the comment from the Language drop-down list. The possible options are OCL and plain text.
  6. Type the text and apply changes.

To connect a state invariant to a state:

  1. On the diagram Tool Palette, choose the State Invariant button.
  2. Click the target lifeline or execution specification.
  3. In the Object Inspector of the state invariant, select the General node.
  4. In the Invariant kind field, choose States/Regions from the drop-down list.
  5. In the States/Regions field, click the chooser button.
  6. In the Choose States and/or Regions dialog box, select the desired states and/or regions from the model, using the Add button.
  7. Click OK when ready.

    Tip: Alternatively, type the state or region name. If the state or region belongs to a different package, specify its fully-qualified name.

See Also