Java Reference
In-Depth Information
Regarding Target End Constraint and Source End Constraint ele-
ments, it's important to realize that these constraints are evaluated based on
mouse position during the act of creating the link. For example, the source end
constraint is evaluated when starting the link, so the context is that element.
The oppositeEnd variable isn't known yet, so don't reference oppositeEnd in
a source end constraint. Likewise, the target end constraint is evaluated
when the mouse hovers over a target element when drawing the link. At this
point, the oppositeEnd environment variable has a value.
Our final mapping is for the generalization link, shown in Table 4.43. Recall
that we'll be using the provided Connection from the classDiagram.
gmfgraph model. Normally, we'd have to load this model using the Load
Resource action, as done before in the graphical definition model. But because
that model includes a reference to the classDiagram.gmfgraph model and is
open in our mapping model resource set, the connection is already available to
our mapping model.
Table 4-43
Generalization Mapping
Element
Property
Value
Mapping
Link Mapping
Containment Feature
Class.superclasses : Class
Diagram Link
Connection
SolidConnectionWDstClosedArrow
Tool
Creation Tool Generalization
Link Constraints
Source End Constraint
Body
self.superclasses->isEmpty()
Language
ocl
Target End Constraint
Body
*
Language
ocl
* As was the case with the Aggregation constraint, this is the verbose OCL constraint for
generalizations:
oppositeEnd <> self and not superclasses->includes(oppositeEnd) and
((oppositeEnd.oclIsTypeOf(dnc::Role) and self.oclIsTypeOf(dnc::Role))
or
(oppositeEnd.oclIsTypeOf(dnc::Party) and self.oclIsTypeOf(dnc::Party))
or
(oppositeEnd.oclIsTypeOf(dnc::Place) and self.oclIsTypeOf(dnc::Place))
Search WWH ::




Custom Search