Interaction Fragments


Interaction Fragments

An interaction fragment is a distinct piece of an interaction. The following subsections describe the seven kinds of interaction fragments.

Combined Fragments

A combined fragment is a combination of one or more interaction operands, each of which contains one or more interaction fragments, and an interaction operator, which operates on those operands.

There are 12 types of interaction operators; they are described as follows :

  • alt (The combined fragment represents a choice of behaviors: Each fragment has an associated guard, which means that at most one of the operands will execute.)

  • assert (The combined fragment represents an assertion: The fragment must occur exactly as specified.)

  • break (The combined fragment represents a breaking scenario: The operand is performed instead of the remainder of the enclosing interaction fragment.)

  • consider (The combined fragment is designating which types of messages should be considered and which should be ignored.)

  • critical (The combined fragment represents a critical region: The system ignores any interrupts until everything within the region has finished executing.)

  • ignore (The combined fragment does not show at least one message type, which means that these message types can be considered insignificant and are ignored if they appear in a corresponding behavior execution.)

  • loop (The combined fragment represents a loop: The loop operand is repeated the specified number of times.)

  • neg (The combined fragment represents one or more messages defined to be invalid.)

  • opt (The combined fragment represents a choice of behavior where either the sole operand happens or nothing happens, based on the evaluation of the associated guard.)

  • par (The combined fragment represents a parallel merge between the behaviors of the operands: The different operands can be interleaved in any way.)

  • seq (The combined fragment represents a "weak" sequencing between the behaviors of the operands, which means the following: [a] The ordering of messages within each of the operands is maintained in the result; [b] messages on different lifelines from different operands may come in any order; and [c] messages on the same lifeline from different operands are ordered such that a message within the first operand comes before that of the second operand.)

  • strict (The combined fragment represents a strict sequencing between the behaviors of the operands.)

Figure 8-2 shows how a combined fragment, partially defined by the loop interaction operator, appears on a sequence diagram.


Figure 8-2: Combined fragment

Interaction operands are separated by dashed lines on a sequence diagram, as shown in Figure 8-3.


Figure 8-3: Interaction operands

Figure 8-3 shows two interaction constraints; these are Boolean expressions that guard operands within a combined fragment.

Continuations

A continuation defines a continuation of one branch of a combined fragment that is partially defined by the alt interaction operator.

Figure 8-4 shows how continuations appear on a sequence diagram.


Figure 8-4: Continuations

If Object1 currently resides in State1, Object1 sends Message2 to Object2 while remaining in State1. If Object1 is in State2 instead, Object1 sends Message3 instead while remaining in State2.

Event Occurrences

An event occurrence represents a moment in time with which an action is associated. There are three kinds of event occurrences, described as follows:

  • A message end represents what can occur at the end of a message in the context of a given interaction.

  • A gate serves as a connection point for relating a message outside a given interaction fragment with a message inside the fragment.

  • A stop defines the termination of the instance connected to a given lifeline. A stop appears as an X at the bottom of the lifeline, as shown in Figure 8-5.


    Figure 8-5: Stop

One can specify general ordering of two event occurrences: One must occur before the other within a given interaction.

Execution Occurrences

An execution occurrence represents the instantiation of a unit of a particular behavior on a lifeline, expressed in terms of a starting event occurrence (such as the receipt of a message) and an ending event occurrence (such as a reply to that message).

Interaction Occurrences

An interaction occurrence represents the occurrence of a piece of a particular interaction with specific values replacing the value placeholders defined for the interaction. Interaction occurrences are generally used to factor out common behavior that exists within a number of interactions.

Figure 8-6 shows how an interaction occurrence appears on a sequence diagram.


Figure 8-6: Interaction occurrence

Part Decompositions

A part decomposition describes the behavior of a part that belongs to the internal structure of some model element (see the section "Internal Class Structure" in Chapter 1).

Figure 8-7 shows how a part decomposition appears on a sequence diagram.


Figure 8-7: Part decomposition

The referenced interaction fragment is a description of some of the behavior associated with Part1, which belongs to the class to which Object2 belongs.

State Invariants

A state invariant serves as a runtime constraint on a given lifeline. The constraint is evaluated immediately before the next scheduled event occurrence (see the section "Event Occurrences," earlier in this chapter).

You model a state invariant using the same curly brackets as you would use for other constraints (see the section "More About Operations" in Chapter 1).




Fast Track Uml 2.0
Fast Track UML 2.0
ISBN: 1590593200
EAN: 2147483647
Year: 2004
Pages: 97

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net