org.eclipse.emf.compare.diff.merge
Class EMFCompareEObjectCopier

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>
          extended by org.eclipse.emf.ecore.util.EcoreUtil.Copier
              extended by org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>

public class EMFCompareEObjectCopier
extends org.eclipse.emf.ecore.util.EcoreUtil.Copier

Defines here a new copier to alter the way references are copied when an EObject is. References corresponding to unmatched object need specific handling.

This map's content should be cleared when all differences of diffModel are merged.

Since:
0.8
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
resolveProxies, useOriginalReferences
 
Constructor Summary
EMFCompareEObjectCopier(DiffModel diff)
          Creates a Copier given the DiffModel it will be used for.
 
Method Summary
protected  void copyReference(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyEObject)
          
 void copyReferences()
          
 org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference, org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EObject value)
          This will copy the given value to the reference targetReference of target.
 org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference, org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EObject value, org.eclipse.emf.ecore.EObject matchedValue)
          This will copy the given value to the reference targetReference of target.
 org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference, org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EObject value, org.eclipse.emf.ecore.EObject matchedValue, int index)
          This will copy the given value to the reference targetReference of target.
 void copyXMIIDs()
          Ensures the original and copied objects all share the same XMI ID.
 DiffModel getDiffModel()
          Returns the DiffModel associated to this copier.
 
Methods inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
copy, copyAll, copyAttribute, copyContainment, copyProxyURI, createCopy, getTarget, getTarget
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

EMFCompareEObjectCopier

public EMFCompareEObjectCopier(DiffModel diff)
Creates a Copier given the DiffModel it will be used for.

Parameters:
diff - The DiffModel Which elements will be merged using this copier.
Method Detail

copyReferences

public void copyReferences()

Overrides:
copyReferences in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
See Also:
EcoreUtil.Copier.copyReferences()

copyReferenceValue

public org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference,
                                                        org.eclipse.emf.ecore.EObject target,
                                                        org.eclipse.emf.ecore.EObject value)
This will copy the given value to the reference targetReference of target.

Parameters:
targetReference - The reference to add a value to.
target - The object to copy to.
value - The value that is to be copied.
Returns:
The copied value.

copyReferenceValue

public org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference,
                                                        org.eclipse.emf.ecore.EObject target,
                                                        org.eclipse.emf.ecore.EObject value,
                                                        org.eclipse.emf.ecore.EObject matchedValue,
                                                        int index)
This will copy the given value to the reference targetReference of target.

Parameters:
targetReference - The reference to add a value to.
target - The object to copy to.
value - The value that is to be copied.
matchedValue - Matched value of value if it is known. Will behave like copyReferenceValue(EReference, EObject, EObject) if null.
index - an optional index in case the target is a List (-1 is a good default, the value will be appended to the list)
Returns:
The copied value.

copyReferenceValue

public org.eclipse.emf.ecore.EObject copyReferenceValue(org.eclipse.emf.ecore.EReference targetReference,
                                                        org.eclipse.emf.ecore.EObject target,
                                                        org.eclipse.emf.ecore.EObject value,
                                                        org.eclipse.emf.ecore.EObject matchedValue)
This will copy the given value to the reference targetReference of target.

Parameters:
targetReference - The reference to add a value to.
target - The object to copy to.
value - The value that is to be copied.
matchedValue - Matched value of value if it is known. Will behave like copyReferenceValue(EReference, EObject, EObject) if null.
Returns:
The copied value.

copyXMIIDs

public void copyXMIIDs()
Ensures the original and copied objects all share the same XMI ID.


getDiffModel

public DiffModel getDiffModel()
Returns the DiffModel associated to this copier.

Returns:
The DiffModel associated to this copier.

copyReference

protected void copyReference(org.eclipse.emf.ecore.EReference eReference,
                             org.eclipse.emf.ecore.EObject eObject,
                             org.eclipse.emf.ecore.EObject copyEObject)

Overrides:
copyReference in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
See Also:
EcoreUtil.Copier.copyReference(org.eclipse.emf.ecore.EReference, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)

Copyright 2006 IBM Corporation and others.
All Rights Reserved.