7.3 Link Actions


Just as classes have actions that create and delete their objects, so associations have actions that create and delete their instances, called links.

Figure 7.7 lists a syntax for several link actions, and several examples are shown in Figure 7.8.

Figure 7.7. Syntax for Link Actions

graphics/07fig07.gif

Figure 7.8. Link Action Examples

graphics/07fig08.gif

As you would expect, the order of the two object references is immaterial, so the first two statements are equivalent. For clarity, the association end can be included, as illustrated by the third statement. The association end is required to specify the direction of traversal in a reflexive association.

The examples in the second block all show traversals. The dagger "points" to the target class, and the square brackets contain the association name. The one after the select statement indicates the target of the traversal is a single instance across an association with multiplicity 1 or 0..1. When the association has a "many" multiplicity (1..* or 0..*), use select many to get the complete set of related instances or select any to get one arbitrary instance.

The last statement unrelates two objects by providing object references and the association name.



Executable UML. A Foundation for Model-Driven Architecture
Executable UML: A Foundation for Model-Driven Architecture
ISBN: 0201748045
EAN: 2147483647
Year: 2001
Pages: 161

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