de.cau.cs.kieler.ktm.extensions
public class TransformationTreeExtensions extends java.lang.Object
Constructor and Description |
---|
TransformationTreeExtensions() |
Modifier and Type | Method and Description |
---|---|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
addTransformationToTree(com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> mapping,
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode,
java.lang.String transformationID,
org.eclipse.emf.ecore.EObject sourceModelRoot,
org.eclipse.emf.ecore.EObject targetModelRoot,
java.lang.String targetModelTypeID)
Appends transformation mapping information about source- and target-model to given tree.
|
java.util.List<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper> |
children(de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper element,
de.cau.cs.kieler.ktm.transformationtree.ModelTransformation tranformation)
Returns all child objects in target model of given ModelTransformation associated with given element.
|
java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelWrapper> |
children(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
Returns all child models of this node in tree, where given model is transformed into.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
findModelInTree(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper tree,
org.eclipse.emf.ecore.EObject modelRoot,
java.lang.String modelTypeID)
Searches given transformation tree for matching model-nodes for given model instance and typeID
If tree is malformed and there are more than one fully matching model the first one is returned.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
initializeTransformationTree(com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> mapping,
java.lang.String transformationID,
org.eclipse.emf.ecore.EObject sourceModelRoot,
java.lang.String sourceModelTypeID,
org.eclipse.emf.ecore.EObject targetModelRoot,
java.lang.String targetModelTypeID)
Creates a new transformation tree containing given mapping as first transformation.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
makeTransient(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode)
Sets ModelWrapper's transient flag and removes references to concrete Objects in all elements of given model.
|
java.util.Map<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper,org.eclipse.emf.ecore.EObject> |
objectMapping(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode,
org.eclipse.emf.ecore.EObject model)
Returns a mapping from Elements of a model in tree to a model instance.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
parent(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
Returns source model-node in tree, where given model is transformed from.
|
java.util.List<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper> |
parents(de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper element,
de.cau.cs.kieler.ktm.transformationtree.ModelTransformation tranformation)
Returns all parent objects in source model of given ModelTransformation associated with given element.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
removeModelFromTree(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode)
Removes given model from tree including all succeeding Models and EObjectWrapper-Mappings
Returns parent in tree
Returns null tree does not contain given model or model has no root
|
com.google.common.collect.Multimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> |
resolveMapping(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper sourceModelNode,
org.eclipse.emf.ecore.EObject sourceModel,
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper targetModelNode,
org.eclipse.emf.ecore.EObject targetModel)
Resolves a mapping between all elements of source and target model instances by their nodes in transformation tree.
|
de.cau.cs.kieler.ktm.transformationtree.ModelWrapper |
root(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
Returns root model-node of tree.
|
java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelWrapper> |
succeedingModels(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
Returns all succeeding models for given model.
|
java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelTransformation> |
succeedingTransformations(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
Returns all succeeding ModelTransformations for given model-node.
|
public de.cau.cs.kieler.ktm.transformationtree.ModelWrapper addTransformationToTree(com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> mapping, de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode, java.lang.String transformationID, org.eclipse.emf.ecore.EObject sourceModelRoot, org.eclipse.emf.ecore.EObject targetModelRoot, java.lang.String targetModelTypeID)
If this is the first transformation use
initializeTransformationTree
.
New transformation will be appended to modelNode representing source model.
Transformations CANNOT appended to transient models!
Completeness of mapping will not be checked. Only objects from mapping are created as Elements of Models in TransformationTree. If previous transformation mapping of source model was incomplete and current mapping contains information about missing objects in source model additional Elements of source model model in transformation tree will be created. If mapping is incomplete (model contains unmapped elements) later resolved mapping my be incomplete. If mapping contains entries for objects not contained in given model instances they will omitted.
Returns new leaf in tree as ModelWrapper representing target model.
Return null if sourceModel is not modelNode or model is transient.
mapping
- object mapping datamodelNode
- node in tree to append transformation, representing source modeltransformationID
- a unique identifier for initial transformationsourceModelRoot
- root element of source model instancetargetModelRoot
- root element of target model instancetargetModelTypeID
- unique identifier for this kind of model and its applied transformationjava.lang.NullPointerException
- if any argument is null.public java.util.List<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper> children(de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper element, de.cau.cs.kieler.ktm.transformationtree.ModelTransformation tranformation)
If source model of given ModelTransformation does not contain given element returned list is empty.
element
- element of a model in transformation tree.tranformation
- model transformation to resolve parent relation.public java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelWrapper> children(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
model
- model in treepublic de.cau.cs.kieler.ktm.transformationtree.ModelWrapper findModelInTree(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper tree, org.eclipse.emf.ecore.EObject modelRoot, java.lang.String modelTypeID)
If tree is malformed and there are more than one fully matching model the first one is returned.
Returns null if no model is found or can not be identified because it is transient.
tree
- root model of treemodelRoot
- root element of a model instance to search for.modelTypeID
- unique identifier for searched kind of models.public de.cau.cs.kieler.ktm.transformationtree.ModelWrapper initializeTransformationTree(com.google.common.collect.ImmutableMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> mapping, java.lang.String transformationID, org.eclipse.emf.ecore.EObject sourceModelRoot, java.lang.String sourceModelTypeID, org.eclipse.emf.ecore.EObject targetModelRoot, java.lang.String targetModelTypeID)
Completeness of mapping will not be checked. Only objects from mapping are created as Elements of Models in TransformationTree. If mapping is incomplete (model contains unmapped elements) later resolved mapping my be incomplete. If mapping contains entries for objects not contained in given model instances they will omitted.
Returns leaf of new tree as ModelWrapper representing target model.
mapping
- object mapping datatransformationID
- a unique identifier for initial transformationsourceModelRoot
- root element of source model instancesourceModelTypeID
- unique identifier for this kind of modeltargetModelRoot
- root element of target model instancetargetModelTypeID
- unique identifier for this kind of model and its applied transformationjava.lang.NullPointerException
- if any argument is null.public de.cau.cs.kieler.ktm.transformationtree.ModelWrapper makeTransient(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode)
Transient model can't be source model of any new transformation and has no association to it's concrete model.
This will improve scalability because transient models will not be kept in memory or persistent.
Can't be reverted.
modelNode
- model to convertpublic java.util.Map<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper,org.eclipse.emf.ecore.EObject> objectMapping(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode, org.eclipse.emf.ecore.EObject model)
ReferencedObjects of Elements in ModelWrapper in transformation tree are only copies of their origin instances. Returned mapping provides relations between Elements and their represented objects in given model instance.
Return null if any argument is null or model and model of modelNode does not match. If transformation tree was created on incomplete mappings returned mapping may be incomplete.
modelNode
- node in tree which models elements shall be mappedmodel
- root element of a model instance to map topublic de.cau.cs.kieler.ktm.transformationtree.ModelWrapper parent(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
If model is root-node, returns null.
model
- model in treepublic java.util.List<de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper> parents(de.cau.cs.kieler.ktm.transformationtree.EObjectWrapper element, de.cau.cs.kieler.ktm.transformationtree.ModelTransformation tranformation)
If target model of given ModelTransformation does not contain given element returned list is empty.
element
- element of a model in transformation tree.tranformation
- model transformation to resolve parent relation.public de.cau.cs.kieler.ktm.transformationtree.ModelWrapper removeModelFromTree(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper modelNode)
Returns parent in tree
Returns null tree does not contain given model or model has no root
modelNode
- node in tree to removepublic com.google.common.collect.Multimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> resolveMapping(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper sourceModelNode, org.eclipse.emf.ecore.EObject sourceModel, de.cau.cs.kieler.ktm.transformationtree.ModelWrapper targetModelNode, org.eclipse.emf.ecore.EObject targetModel)
Returns a multi-mapping from elements of source model to target model elements. Mapping is created by resolving all transformations on a path from source to target. Source and target can be arbitrary model in tree, so path can be bottom up, top down or leaf to leaf.
Returns null if source or target model do not match to their models in tree or if they are not in the same tree. If transformation tree was created on incomplete mappings returned mapping may be incomplete.
sourceModelNode
- model in transformation tree representing sourceModel modelsourceModel
- root element of a source model instancetargetModelNode
- model in transformation tree representing targetModel modeltargetModel
- root element of a target model instancepublic de.cau.cs.kieler.ktm.transformationtree.ModelWrapper root(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
model
- any model-node in treepublic java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelWrapper> succeedingModels(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
BFS will be performed on sub tree.
model
- model in treepublic java.util.List<de.cau.cs.kieler.ktm.transformationtree.ModelTransformation> succeedingTransformations(de.cau.cs.kieler.ktm.transformationtree.ModelWrapper model)
BFS will be performed on sub tree.
model
- model in tree