Previous UML Classes Table of Contents UML Packages Next


14.3.31 StateInvariant

BasicInteractions


*Generalizations

   

    InteractionFragment (from BasicInteractions , Fragments ) on page 505

*Description

   A StateInvariant is a runtime constraint on the participants of the interaction. It may be used to specify a variety of different kinds of constraints, such as values of attributes or variables, internal or external states, and so on.

   A StateInvariant is an InteractionFragment and it is placed on a Lifeline .

   Associations

   Semantics

   The Constraint is assumed to be evaluated during runtime. The Constraint is evaluated immediately prior to the execution of the next OccurrenceSpecification such that all actions that are not explicitly modeled have been executed. If the Constraint is true, the trace is a valid trace; if the Constraint is false, the trace is an invalid trace. In other words all traces that have a StateInvariant with a false Constraint are considered invalid.

   Notation

   The possible associated Constraint is shown as text in curly brackets on the lifeline. See example in Figure 14.24 on page 532.

   Presentation Options

   A StateInvariant can optionally be shown as a Note associated with an OccurrenceSpecification.

   The state symbol represents the equivalent of a constraint that checks the state of the object represented by the Lifeline . This could be the internal state of the classifierBehavior of the corresponding Classifier, or it could be some external state based on a black-box view of the Lifeline . In the former case, and if the classifierBehavior is described by a state machine, the name of the state should match the hierarchical name of the corresponding state of the state machine.

   The regions represent the orthogonal regions of states. The identifier need only define the state partially. The value of the constraint is true if the specified state information is true.

    The example in Figure 14.24 also shows this presentation option.