In Unified Modeling Language (UML) sequence diagrams, an interaction operator defines the semantics of a combined fragment and determines how to use the interaction operands in the combined fragment.
A combined fragment might contain the following interaction operators
Interaction operator | Description |
---|---|
Alternative | An alt interaction operator identifies a set of behaviors from which the interaction can choose based on specified criteria. Only one of the offered alternatives will execute on any one pass through the interaction. However, as is true of any operand, the selected operand in the alt structure executes only if the guard condition tests true. If there is no guard, the operand always executes when it is selected. The else clause of the alt combined fragment executes whenever none of the other options is selected. |
Option | An opt interaction operator represents a behavior that might or might not be used as part of the interaction. To be used, the guard condition must be satisfied. If the guard condition fails, the behavior is ignored. The graphic representation of an opt combined fragment looks like an alt that offers only one interaction. |
Loop | A loop interaction operator indicates that the interaction fragment is executed repeatedly. The number of times it is executed is determined by the minint and maxint parameters of the operator. The syntax of the loop operator is loop (minint, maxint) where maxint can also be infinity (*). After the minimum number of iterations has been satisfied, a Boolean expression is tested on each pass. When the Boolean expression tests false, the loop ends. |
The following figure illustrates how interaction operators are represented in an interaction.