blob: d279180f61941753b6e32944e62e7a7033390fff [file] [log] [blame]
<div id="maincontent">
<div id="midcolumn">
<h1>Replacement Operations</h1>
<p>
Replacement operations replace one metamodeling construct by another, equivalent construct.
</p>
<h2 id="introduceReferenceClass">Association to Class</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>reference</tt>: The reference to be replaced by a reference class</li>
<li><tt>className</tt>: The name of the reference class</li>
<li><tt>sourceReferenceName</tt>: The name of the opposite reference to the source class</li>
<li><tt>targetReferenceName</tt>: The name of the opposite reference to the target class</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>Reference has to have an opposite</li>
<li>Reference is not allowed to be containment</li>
<li>Opposite reference is not allowed to be containment</li>
</ul>
</p>
<h2 id="org.eclipse.emf.edapt.declaration.replacement.ClassToAssociation">Class to Association</h2>
<p>
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>eClass</tt>: Class to be replaced by an association</li>
<li><tt>sourceReference</tt>: Reference to the source class of the association</li>
<li><tt>targetReference</tt>: Reference to the target class of the association</li>
<li><tt>associationName</tt>: Name of the new association</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>The class must not have any sub types.</li>
<li>The source reference must be single-valued and not containment.</li>
<li>The source reference must be defined in the class</li>
<li>The target reference must be single-valued and not containment.</li>
<li>The source reference must be defined in the class</li>
<li>The class may only be targeted by one containment reference and the opposite of source and target reference.</li>
</ul>
</p>
<h2 id="enumerationToSubClasses">Enumeration to Sub Classes</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>enumAttribute</tt>: The enumeration attribute</li>
<li><tt>ePackage</tt>: The package in which the subclasses are created</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>The context class must be concrete</li>
<li>The context class must not have sub types</li>
<li>The type of the attribute must be an enumeration</li>
</ul>
</p>
<h2 id="replaceIdentifierByReference">Identifier to Reference</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>referencingAttribute</tt>: The referencing attribute</li>
<li><tt>referencedAttribute</tt>: The referenced attribute</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>Referencing and referenced attribute must be of the same type</li>
</ul>
</p>
<h2 id="replaceInheritanceByDelegation">Inheritance to Delegation</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>subClass</tt>: The class from which the super class is removed</li>
<li><tt>superClass</tt>: The super class to be removed</li>
<li><tt>referenceName</tt>: The name of the reference to the super class</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>The super class must be a super type of the sub class</li>
</ul>
</p>
<h2 id="notChangeableToSuppressedSetVisibility">Not Changeable to Suppressed Set Visibility</h2>
<p>
In the metamodel, a reference is made changeable, and at the same time its setter is suppressed. Nothing is changed in the model.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>reference</tt>: The reference to be made changeable</li>
</ul>
</p>
<h2 id="operationToVolatile">Operation to Volatile Feature</h2>
<p>
In the metamodel, an operation is transformed into a volatile feature. In the model, nothing needs to be done.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>operation</tt>: The operation to be transformed</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>The operation must not have parameters</li>
</ul>
</p>
<h2 id="subClassesToEnumeration">Sub Classes to Enumeration</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>contextClass</tt>: The context class</li>
<li><tt>attributeName</tt>: The name of the enumeration attribute</li>
<li><tt>ePackage</tt>: The package in which the enumeration is created</li>
<li><tt>enumName</tt>: The name of the enumeration</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>The context class must have sub types</li>
<li>The context class must be abstract</li>
<li>The sub types must not have sub types again</li>
</ul>
</p>
<h2 id="suppressedSetVisibilityToNotChangeable">Suppressed Set Visibility to Not Changeable</h2>
<p>
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.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>reference</tt>: The reference whose setter is made visible again</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>Suppressed Set Visibility must be present</li>
</ul>
</p>
<h2 id="volatileToOpposite">Volatile to Opposite Reference</h2>
<p>
In the metamodel, a reference is changed from being volatile to an opposite. In the model, the opposite direction needs to be set.
</p>
<p><h5>Parameters:</h5>
<ul>
<li><tt>reference</tt>: The reference which is changed from volatile to opposite</li>
<li><tt>opposite</tt>: The reference which is going to be the opposite</li>
<li><tt>changeable</tt>: Whether the reference is going to be changeable</li>
</ul>
</p>
<p>
<h5>Constraints:</h5>
<ul>
<li>Reference and opposite must be compatible with each other</li>
<li>Reference must be volatile</li>
<li>Reference must not already have an opposite</li>
</ul>
</p>
</div>
<div id="rightcolumn">
<div class="sideitem">
<h6>Contents</h6>
<ul>
<li><a href="org.eclipse.emf.edapt.declaration.creation.StructuralPrimitives.php">Structural Primitives</a></li>
<li><a href="org.eclipse.emf.edapt.declaration.simple.NonStructuralPrimitives.php">Non-structural Primitives</a></li>
<li><a href="org.eclipse.emf.edapt.declaration.generalization.GeneralizationOperations.php">Generalization / Specialization Operations</a></li>
<li><a href="org.eclipse.emf.edapt.declaration.inheritance.InheritanceOperations.php">Inheritance Operations</a></li>
<li><a href="org.eclipse.emf.edapt.declaration.delegation.DelegationOperations.php">Delegation Operations</a></li>
<li><a href="org.eclipse.emf.edapt.declaration.replacement.ReplacementOperations.php">Replacement Operations</a></li>
<ul>
<li><a href="#introduceReferenceClass">Association to Class</a></li>
<li><a href="#org.eclipse.emf.edapt.declaration.replacement.ClassToAssociation">Class to Association</a></li>
<li><a href="#enumerationToSubClasses">Enumeration to Sub Classes</a></li>
<li><a href="#replaceIdentifierByReference">Identifier to Reference</a></li>
<li><a href="#replaceInheritanceByDelegation">Inheritance to Delegation</a></li>
<li><a href="#notChangeableToSuppressedSetVisibility">Not Changeable to Suppressed Set Visibility</a></li>
<li><a href="#operationToVolatile">Operation to Volatile Feature</a></li>
<li><a href="#subClassesToEnumeration">Sub Classes to Enumeration</a></li>
<li><a href="#suppressedSetVisibilityToNotChangeable">Suppressed Set Visibility to Not Changeable</a></li>
<li><a href="#volatileToOpposite">Volatile to Opposite Reference</a></li>
</ul>
<li><a href="org.eclipse.emf.edapt.declaration.merge.MergeOperations.php">Merge Operations</a></li>
</ul>
</div>
</div>
</div>