A State Invariant is an Interaction Fragment which represents a runtime constraint on the participants of the interaction.
A State Invariant can be used to specify different kinds of constraints, such as values of attributes or variables of the object when it is in that state, whether the object is in a particular state, the value of external states, and so on.
The constraint is evaluated immediately prior to the execution of the next occurrence specification such that all actions that are not explicitly modeled have been executed. If the constraint is true, the trace is a valid trace, otherwise the trace is an invalid trace.
Note The ExecutionSpecification (otherwise referred to as a ‘Focus of Control’) rectangular line is designed to show itself above all other symbols on a Sequence diagram.
How to place a State Invariant symbol over an ExecutionSpecification rectangle
If you want to place a State Invariant symbol over an ExecutionSpecification rectangle (as in the image above), you can complete the following steps:
1 Select the StateInvariant symbol (or any symbol on the Sequence diagram).
2 Select Format > Diagram Format > Symbol Display Layering, and then change the choice from By Size and Transparency (Default) to User Control.
3 Select the StateInvariant symbol, and then select Format > Symbol Layering > Bring to the Front.