de.cau.cs.kieler.ktm.extensions
public class TransformationMapping extends java.lang.Object
Constructor and Description |
---|
TransformationMapping() |
Modifier and Type | Method and Description |
---|---|
org.eclipse.xtext.xbase.lib.Pair<com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EObject>,com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EObject>> |
checkMappingCompleteness(org.eclipse.emf.ecore.EObject sourceModel,
org.eclipse.emf.ecore.EObject targetModel)
Checks if mapping is complete
All objects in sourceModel are compared with parents and all targetModel objects are compared to children, both includes given source/target-model objects.
|
void |
clearMapping()
Drops all current mapping information
|
com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> |
extractMappingData()
This will extract mapping data as an immutable copy and clears local mapping afterwards
|
boolean |
mapChild(org.eclipse.emf.ecore.EObject parent,
org.eclipse.emf.ecore.EObject child)
Maps given child as result of this transformation for given parent.
|
boolean |
mapChildren(org.eclipse.emf.ecore.EObject parent,
java.util.List<org.eclipse.emf.ecore.EObject> children)
Maps given children as results of this transformation for given parent.
|
boolean |
mapParent(org.eclipse.emf.ecore.EObject child,
org.eclipse.emf.ecore.EObject parent)
Maps given parent as source of given child in this transformation.
|
boolean |
mapParents(org.eclipse.emf.ecore.EObject child,
java.util.List<org.eclipse.emf.ecore.EObject> parents)
Maps given parents as source of given child in this transformation.
|
java.util.List<org.eclipse.emf.ecore.EObject> |
mappedChildren(org.eclipse.emf.ecore.EObject parent)
Returns all Children mapped to given parent
|
<T extends org.eclipse.emf.ecore.EObject> |
mappedCopy(T original)
Creates direct mapping between two identical models.
|
java.util.List<org.eclipse.emf.ecore.EObject> |
mappedParents(org.eclipse.emf.ecore.EObject child)
Returns all Parents mapped to given child
|
boolean |
unmap(org.eclipse.emf.ecore.EObject first,
org.eclipse.emf.ecore.EObject second)
Removes mapping between given objects.
|
boolean |
unmapAll(org.eclipse.emf.ecore.EObject obj)
Removes all mappings for given objects.
|
public org.eclipse.xtext.xbase.lib.Pair<com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EObject>,com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EObject>> checkMappingCompleteness(org.eclipse.emf.ecore.EObject sourceModel, org.eclipse.emf.ecore.EObject targetModel)
All objects in sourceModel are compared with parents and all targetModel objects are compared to children, both includes given source/target-model objects.
Returns Pair of two sets where were key-element is symmetric difference between source model objects and all parents and value-element is symmetric difference between target and children. All elements are mapped correctly if both sets are empty.
java.lang.NullPointerException
- if sourceModel or targetMode is null.public void clearMapping()
public com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> extractMappingData()
public boolean mapChild(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EObject child)
de.cau.cs.kieler.ktm.exceptions.MappingException
- when child parent relations were mixed (i.e. when one object is will be mapped as parent when it is already mapped as child).java.lang.NullPointerException
- if parent or child is null.public boolean mapChildren(org.eclipse.emf.ecore.EObject parent, java.util.List<org.eclipse.emf.ecore.EObject> children)
de.cau.cs.kieler.ktm.exceptions.MappingException
- when child parent relations were mixed (i.e. when one object is will be mapped as parent when it is already mapped as child).java.lang.NullPointerException
- if parent or children list is null.java.lang.IllegalArgumentException
- if children list contains null element.public boolean mapParent(org.eclipse.emf.ecore.EObject child, org.eclipse.emf.ecore.EObject parent)
de.cau.cs.kieler.ktm.exceptions.MappingException
- when child parent relations were mixed (i.e. when one object is will be mapped as parent when it is already mapped as child).java.lang.NullPointerException
- if parent or child is null.public boolean mapParents(org.eclipse.emf.ecore.EObject child, java.util.List<org.eclipse.emf.ecore.EObject> parents)
de.cau.cs.kieler.ktm.exceptions.MappingException
- when child parent relations were mixed (i.e. when one object is will be mapped as parent when it is already mapped as child).java.lang.NullPointerException
- if parents or child is null.java.lang.IllegalArgumentException
- if children list contains null element.public java.util.List<org.eclipse.emf.ecore.EObject> mappedChildren(org.eclipse.emf.ecore.EObject parent)
public <T extends org.eclipse.emf.ecore.EObject> T mappedCopy(T original)
Use for transformations based on copies.
Mapping will include given root elements.
original
- model to copypublic java.util.List<org.eclipse.emf.ecore.EObject> mappedParents(org.eclipse.emf.ecore.EObject child)
public boolean unmap(org.eclipse.emf.ecore.EObject first, org.eclipse.emf.ecore.EObject second)
Parent child order is arbitrary.
first
- - parent or child object depending on chosen ordersecond
- - parent or child object depending on chosen orderpublic boolean unmapAll(org.eclipse.emf.ecore.EObject obj)
Object can be parent or child