Section 10.9. Interaction Occurrences


10.9. Interaction Occurrences

An interaction occurrence is shorthand for copying one interaction into another, larger interaction. For example, you can create an interaction that simply shows user authentication and then reference it (create an interaction occurrence) in larger, more complete interaction diagrams.

The syntax for an interaction occurrence is a combined fragment rectangle with the interaction operator ref. Place the name of the referenced interaction in the rectangle. UML allows parameters to be passed to referenced interactions using the following syntax:

          attribute_name = collaboration_occurrence.interaction_name ( arguments ) : return_value

where:


attribute_name

Is an optional part of the syntax that specifies what attribute the return value should be applied to. The attribute must be an attribute of a lifeline in the larger interaction.


collaboration_occurrence

Is an optional scoping of the referenced interaction if it is part of a larger collaboration.


interaction_name

Is the name of the interaction to copy.


arguments

Is a comma-separated list of arguments to pass to the referenced interaction. The arguments may be values or parameter names. If only argument values are used, arguments are matched against the interaction parameters, in order. If you want to skip an argument, you place a dash (-) where the argument would be. Skipped arguments have unknown values. You may explicitly identify a parameter name by following its text name with a colon (:) and then the value. If you use parameter names, you may omit arguments not relevant to the interaction. As with a dash, skipped arguments have unknown values.

You may prefix an argument with the keyword out or inout to indicate that the argument is used to return a value. If the argument is used as an out argument, a value after the colon in the argument specification is interpreted to be the return value.


return_value

Is an optional part of the reference that, if present, indicates the value returned by the copied interaction.

Figure 10-30 shows a simple mail transmission sequence diagram that uses an interaction occurrence to refer to another sequence diagram that illustrates user authentication. In this example, the return value from the interaction occurrence is ignored, so it isn't assigned to any variable.

Figure 10-30. Example of an interaction occurrence





UML 2.0 in a Nutshell
UML 2.0 in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596007957
EAN: 2147483647
Year: 2005
Pages: 132

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