The Extends and Replaces variability relationship
combines the effects of Extends and Replaces variabilities
into one variability type. Whereas Replaces variability
completely replaces all attributes and outgoing associations of the base element
with new values and instances, or removes all values or associations if the
replacing element does not define any, Extends and Replaces variability
only replaces values that have been redefined. All other values of the base
element are unaffected. In other words, Extends and Replaces allows
users to selectively replace specific attributes and associations of the base
elements. This type of variability can be used to generate method plug-ins
that rename elements, or replace some descriptions of method elements with
new ones, without completely remodeling all other relationships and attributes
needed by the base plug-in.
Extends and replaces association rules
- Extends and Replace variability combines the effects
of the Extends and the Replaces variabilities. The evaluation first performs
the effects of the Extends and then the effects of the Replaces variability.
This implies that:
- First, the new element will inherit all attributes and associations from
the base element.
- Second, the new elements might override inherited attributes or associations.
- Third, the base element will be replaced with new element using the overridden
values and if no override was specified, keep the inherited values.
- If the extends and replaces element defines outgoing associations, they
replace all outgoing associations of the base elements. If the extends and
replaces element does not define any new associations, the resulting element
retains the associations of the base element.
- Incoming associations from the base element are added to the replacing
element.
- If the extends and replaces element defines attributes, these attributes
are replaced in the resulting element including the base element's identifier.
Undefined attributes retain values used in the base element.
- The base element of a replaces relationship or an extends and replaces
relationship can have only one replaces or extends and replaces element per
configuration. If more than one element is present, no replacement takes place.
- The extends and replaces relationship is transitive and evaluated top-down
relative to the direction of the replacement. If a replacing element is also
replaced, the final replacing element prevails.
- Contributes variability relationships are resolved before replaces and
extends and replaces relationships. Extends relationships are resolved last.
Variability is always resolved top-down from the base to the variability elements.
Within the same level, contributes relationships are resolved first. Replaces
or extends and replaces are resolved afterwards.
How to add an extends and replaces association
- Use the Content Variability section on the Description tab
to make an element extend and replace another element.
- Select Extends and Replaces as the Variability
type and select the base element that this element will replace. The base
element must be the same type of element as the replacing element.