Interaction Operators

Return to Introduction  Previous page  Next page

When creating Combined Fragments, you must apply an appropriate interaction operator to characterize the fragment. The following table provides guidance on the various operators, and their corresponding descriptions.

Interaction Operator

Description

alt

Divides up interaction fragments based on Boolean conditions.

opt

Encloses an optional fragment of interaction.

par

Indicates that operands operate in parallel.

loop

The operand repeats a number of times, as specified by interaction constraints.

critical

Indicates a sequence that cannot be interrupted by other processing.

neg

Asserts that a fragment is invalid, and implies that all other interaction is valid.

assert

Specifies the only valid fragment to occur. Often enclosed within a consider or ignore operand.

strict

Indicates that the behaviors of the operands must be processed in strict sequence.

seq

The Combined Fragment is weakly sequenced. This means that the ordering within operands is maintained, but the ordering between operands is undefined, so long as an event occurrence of the first operand precedes that of the second operand, if the event occurrences are on the same lifeline.

ignore

Indicates which messages should be ignored during execution, or can appear anywhere in the execution trace.

consider

Specifies which messages should be considered in the trace. This is often used to specify the resulting event occurrences with the use of an assert operator.

ref

Provides a reference to another diagram.

Note: The ref fragment is not created using the method described in the Create a Combined Fragment topic. To create a ref fragment, simply drag an existing diagram from the Project Browser window onto the current diagram.

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.0, p. 410-412) states:

"The semantics of a CombinedFragment is dependent upon the interactionOperator as explained below.

"Alternatives

The interactionOperator alt designates that the CombinedFragment represents a choice of behavior. At most one of the operands will execute. The operand that executes must have an explicit or implicit guard expression that evaluates to true at this point in the interaction. An implicit true guard is implied if the operand has no guard. The set of traces that defines a choice is the union of the (guarded) traces of the operands. An operand guarded by else designates a guard that is the negation of the disjunction of all other guards in the enclosing CombinedFragment.

"Option

The interactionOperator opt designates that the CombinedFragment represents a choice of behavior where either the (sole) operand happens or nothing happens. An option is semantically equivalent to an alternative CombinedFragment where there is one operand with non-empty content and the second operand is empty.

"Break

The interactionOperator break designates that the CombinedFragment represents a breaking scenario in the sense that the operand is a scenario that is performed instead of the remainder of the enclosing InteractionFragment. Thus the break operator is a shorthand for an Alternative operator where one operand is given and the other assumed to be the rest of the enclosing InteractionFragment. Break CombinedFragments must be global relative to the enclosing InteractionFragment.

"Parallel

The interactionOperator par designates that the CombinedFragment represents a parallel merge between the behaviors of the operands. The eventoccurrences of the different operands can be interleaved in any way as long as the ordering imposed by each operand as such is preserved. A parallel merge defines a set of traces that describes all the ways that eventoccurrences of the operands may be interleaved without obstructing the order of the eventoccurrences within the operand.

"Weak Sequencing

The interactionOperator seq designates that the CombinedFragment represents a weak sequencing between the behaviors of the operands. Weak sequencing is defined by the set of traces with these properties:

1.The ordering of eventoccurrences within each of the operands are maintained in the result.
2.Eventoccurrences on different lifelines from different operands may come in any order.
3.Eventoccurrences on the same lifeline from different operands are ordered such that an eventoccurrence of the first operand comes before that of the second operand.

Thus weak sequencing reduces to a parallel merge when the operands are on disjunct sets of participants. Weak sequencing reduces to strict sequencing when the operands work on only one participant.

"Strict Sequencing

The interactionOperator strict designates that the CombinedFragment represents a strict sequencing between the behaviors of the operands. The semantics of the strict operation defines a strict ordering of the operands on the first level within the CombinedInteraction with operator strict. Therefore eventoccurrences within contained CombinedInteractions will not directly be compared with other eventoccurrences of the enclosing CombinedInteraction.

"Negative

The interactionOperator neg designates that the CombinedFragment represents traces that are defined to be invalid. The set of traces that defined a negative CombinedFragment is equal to the set of traces given by its (sole) operand, only that this set is a set of invalid rather than valid traces. All InteractionFragments that are different from Negative are considered positive meaning that they describe traces that are valid and should be possible.

"Critical Region

The interactionOperator critical designates that the CombinedFragment represents a critical region. A critical region means that the traces of the region cannot be interleaved by other Eventoccurrences (on those Lifelines covered by the region). This means that the region is treated atomically by the enclosing fragment when determining the set of valid traces. Even though enclosing CombinedFragments may imply that some Eventoccurrences may interleave into the region, such as eg. with par-operator, this is prevented by defining a region. Thus the set of traces of enclosing constructs are restricted by critical regions.

"Ignore / Consider

The interactionOperator ignore designates that there are some message types that are not shown within this combined fragment. These message types can be considered insignificant and are intuitively ignored if they appear in a corresponding execution. Alternatively one can understand ignore to mean that the messages that are ignored can appear anywhere in the traces. Conversely the interactionOperator consider designates which messages should be considered within this CombinedFragment. This is equivalent to defining every other message to be ignored.

"Assertion

The interactionOperator assert designates that the CombinedFragment represents an assertion. The sequences of the operand of the assertion are the only valid continuations. All other continuations result in an invalid trace. Assertions are often combined with Ignore or Consider as shown in Figure 345.

"Loop

The interactionOperator loop designates that the CombinedFragment represents a loop. The loop operand will be repeated a number of times. The Guard may include a lower and an upper number of iterations of the loop as well as a Boolean expression. The semantics is such that a loop will iterate minimum the 'minint' number of times (given by the iteration expression in the guard) and at most the 'maxint' number of times. After the minimum number of iterations have executed, and the boolean expression is false the loop will terminate. The loop construct represent a recursive application of the seq operator where the loop operand is sequenced after the result of earlier iterations.

"The Semantics of Gates (see also 'Gate (from Fragments)' on page 418)

The gates of a CombinedFragment represent the syntactic interface between the CombinedFragment and its surroundings, which means the interface towards other InteractionFragments. The only purpose of gates is to define the source and the target of Messages or General Order relations."