Replacement Operations
Replacement operations replace one metamodeling construct by another, equivalent construct.
Association to Class
In the metamodel, a reference is replaced by a reference class. More specifically, the reference class is now contained by the source class. In the model, links conforming to the reference are replaced by instances of the reference class.
Parameters:
- reference: The reference to be replaced by a reference class
- className: The name of the reference class
- sourceReferenceName: The name of the opposite reference to the source class
- targetReferenceName: The name of the opposite reference to the target class
Constraints:
- Reference has to have an opposite
- Reference is not allowed to be containment
- Opposite reference is not allowed to be containment
Class to Association
Parameters:
- eClass: Class to be replaced by an association
- sourceReference: Reference to the source class of the association
- targetReference: Reference to the target class of the association
- associationName: Name of the new association
Constraints:
- The class must not have any sub types.
- The source reference must be single-valued and not containment.
- The source reference must be defined in the class
- The target reference must be single-valued and not containment.
- The source reference must be defined in the class
- The class may only be targeted by one containment reference and the opposite of source and target reference.
Enumeration to Sub Classes
In the metamodel, an enumeration attribute of a class is replaced by subclasses. The class is made abstract, and a subclass is created for each literal of the enumeration. The enumeration attribute is deleted and also the enumeration, if not used otherwise. In the model, instances the class are migrated to the appropriate subclass according to the value of the enumeration attribute.
Parameters:
- enumAttribute: The enumeration attribute
- ePackage: The package in which the subclasses are created
Constraints:
- The context class must be concrete
- The context class must not have sub types
- The type of the attribute must be an enumeration
Identifier to Reference
In the metamodel, an attribute that references elements by identifier is replaced by a reference. In the model, its values are replaced by references to that element.
Parameters:
- referencingAttribute: The referencing attribute
- referencedAttribute: The referenced attribute
Constraints:
- Referencing and referenced attribute must be of the same type
Inheritance to Delegation
In the metamodel, inheritance from a super class is replaced by delegation to this class. More specifically, the super class is removed and a containment reference to this class is created. In the model, the contents associated to the super class are extracted to a separate instance of the super class.
Parameters:
- subClass: The class from which the super class is removed
- superClass: The super class to be removed
- referenceName: The name of the reference to the super class
Constraints:
- The super class must be a super type of the sub class
Not Changeable to Suppressed Set Visibility
In the metamodel, a reference is made changeable, and at the same time its setter is suppressed. Nothing is changed in the model.
Parameters:
- reference: The reference to be made changeable
Operation to Volatile Feature
In the metamodel, an operation is transformed into a volatile feature. In the model, nothing needs to be done.
Parameters:
- operation: The operation to be transformed
Constraints:
- The operation must not have parameters
Sub Classes to Enumeration
In the metamodel, the subclasses of a class are replaced by an enumeration. An enumeration with literals for all subclasses is created and an enumeration attribute is created in the class. Finally, all subclasses are deleted, and the class is made concrete. In the model, instances of a subclass are migrated to the class, setting the enumeration attribute to the appropriate literal.
Parameters:
- contextClass: The context class
- attributeName: The name of the enumeration attribute
- ePackage: The package in which the enumeration is created
- enumName: The name of the enumeration
Constraints:
- The context class must have sub types
- The context class must be abstract
- The sub types must not have sub types again
Suppressed Set Visibility to Not Changeable
In the metamodel, the setter of a reference is made visible again, and at the same time it is made non-changeable. Nothing is changed in the model.
Parameters:
- reference: The reference whose setter is made visible again
Constraints:
- Suppressed Set Visibility must be present
Volatile to Opposite Reference
In the metamodel, a reference is changed from being volatile to an opposite. In the model, the opposite direction needs to be set.
Parameters:
- reference: The reference which is changed from volatile to opposite
- opposite: The reference which is going to be the opposite
- changeable: Whether the reference is going to be changeable
Constraints:
- Reference and opposite must be compatible with each other
- Reference must be volatile
- Reference must not already have an opposite
Contents
- Structural Primitives
- Non-structural Primitives
- Generalization / Specialization Operations
- Inheritance Operations
- Delegation Operations
- Replacement Operations
- Association to Class
- Class to Association
- Enumeration to Sub Classes
- Identifier to Reference
- Inheritance to Delegation
- Not Changeable to Suppressed Set Visibility
- Operation to Volatile Feature
- Sub Classes to Enumeration
- Suppressed Set Visibility to Not Changeable
- Volatile to Opposite Reference
- Merge Operations