## org.eclipse.emf.compare.diff.engine.check
Class ReferencesCheck

    java.lang.Object
      org.eclipse.emf.compare.diff.engine.check.AbstractCheck
          org.eclipse.emf.compare.diff.engine.check.ReferencesCheck

    public class ReferencesCheck

extends AbstractCheck

This will implement the reference checks : order of reference values, changes between two versions, ...

Since:
  1.0

Field Summary

Fields inherited from class org.eclipse.emf.compare.diff.engine.check.AbstractCheck
`ANCESTOR_OBJECT, crossReferencer, LEFT_OBJECT, RIGHT_OBJECT`

Constructor Summary
`ReferencesCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)` Simply delegates to the super constructor.

Method Summary
`protected void` `checkContainmentReferenceOrderChange(DiffGroup root, Match2Elements mapping, org.eclipse.emf.ecore.EReference reference)` This will be called to check for ordering changes on a given containment reference values.
`protected void` `checkReferenceOrderChange(DiffGroup root, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject leftElement, org.eclipse.emf.ecore.EObject rightElement, java.util.List<ReferenceChangeLeftTarget> addedReferences, java.util.List<ReferenceChangeRightTarget> removedReferences)` This will be called to check for changes on a given reference values.
`void` `checkReferencesUpdates(DiffGroup root, Match2Elements mapping)` Checks if there's been references updates in the model.
`void` `checkReferencesUpdates(DiffGroup root, Match3Elements mapping)` Checks if there's been references updates in the model.
`protected void` `checkReferenceUpdates(DiffGroup root, Match2Elements mapping, org.eclipse.emf.ecore.EReference reference)` This will check that the values of the given reference from the objects contained by mapping has been modified.
`protected void` `checkReferenceUpdates(DiffGroup root, Match3Elements mapping, org.eclipse.emf.ecore.EReference reference)` This will check that the values of the given reference from the objects contained by mapping has been modified.
`protected boolean` `shouldBeIgnored(org.eclipse.emf.ecore.EReference reference)` Determines if we should ignore a reference for diff detection.

Methods inherited from class org.eclipse.emf.compare.diff.engine.check.AbstractCheck
`convertFeatureMapList, getMatchedEObject, getMatchedEObject, isUnmatched`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReferencesCheck

    public ReferencesCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)

  Simply delegates to the super constructor.

  Parameters:
    `referencer` - CrossReferencer instantiated with the match model or match resource set.
  See Also:
    `AbstractCheck#DefaultCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer)}`

Method Detail

### checkReferencesUpdates

    public void checkReferencesUpdates(DiffGroup root,
                                       Match2Elements mapping)
                                throws FactoryException

  Checks if there's been references updates in the model.

  A reference is considered updated if its value(s) has been changed (either removal or addition of an element if the reference is multi-valued or update of a single-valued reference) between the left and the right model.

  Parameters:
    `root` - `root` of the `DiffElement` to create.
    `mapping` - Contains informations about the left and right model elements we have to compare.
  Throws:
    `FactoryException` - Thrown if we cannot fetch the references' values.

### checkReferencesUpdates

    public void checkReferencesUpdates(DiffGroup root,
                                       Match3Elements mapping)
                                throws FactoryException

  Checks if there's been references updates in the model.

  A reference is considered updated if its value(s) has been changed (either removal or addition of an element if the reference is multi-valued or update of a single-valued reference) between the left and the ancestor model, the right and the ancestor or between the left and the right model.

  Parameters:
    `root` - `root` of the `DiffElement` to create.
    `mapping` - Contains informations about the left, right and origin model elements we have to compare.
  Throws:
    `FactoryException` - Thrown if we cannot fetch the references' values.

### checkContainmentReferenceOrderChange

    protected void checkContainmentReferenceOrderChange(DiffGroup root,
                                                        Match2Elements mapping,
                                                        org.eclipse.emf.ecore.EReference reference)
                                                 throws FactoryException

  This will be called to check for ordering changes on a given containment reference values.

  Parameters:
    `root` - `Root` of the `DiffElement`s to create.
    `mapping` - Contains informations about the left and right model elements we have to compare.
    `reference` - `EReference` to check for modifications.
  Throws:
    `FactoryException` - Thrown if we cannot fetch the references' values.

### checkReferenceOrderChange

    protected void checkReferenceOrderChange(DiffGroup root,
                                             org.eclipse.emf.ecore.EReference reference,
                                             org.eclipse.emf.ecore.EObject leftElement,
                                             org.eclipse.emf.ecore.EObject rightElement,
                                             java.util.List<ReferenceChangeLeftTarget> addedReferences,
                                             java.util.List<ReferenceChangeRightTarget> removedReferences)
                                      throws FactoryException

  This will be called to check for changes on a given reference values. Note that we know `reference.isMany()` and `reference.isOrdered()` always return true here for the generic diff engine and the tests won't be made.

  Parameters:
    `root` - `Root` of the `DiffElement`s to create.
    `reference` - `EReference` to check for modifications.
    `leftElement` - Element corresponding to the final holder of the given reference.
    `rightElement` - Element corresponding to the initial holder of the given reference.
    `addedReferences` - Contains the created differences for added reference values.
    `removedReferences` - Contains the created differences for removed reference values.
  Throws:
    `FactoryException` - Thrown if we cannot fetch the references' values.

### checkReferenceUpdates

    protected void checkReferenceUpdates(DiffGroup root,
                                         Match2Elements mapping,
                                         org.eclipse.emf.ecore.EReference reference)
                                  throws FactoryException

  This will check that the values of the given reference from the objects contained by mapping has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create.
    `mapping` - Contains informations about the left and right model elements we have to compare.
    `reference` - The reference we need to check for differences.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.

### checkReferenceUpdates

    protected void checkReferenceUpdates(DiffGroup root,
                                         Match3Elements mapping,
                                         org.eclipse.emf.ecore.EReference reference)
                                  throws FactoryException

  This will check that the values of the given reference from the objects contained by mapping has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create.
    `mapping` - Contains informations about the left and right model elements we have to compare.
    `reference` - The reference we need to check for differences.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.

### shouldBeIgnored

    protected boolean shouldBeIgnored(org.eclipse.emf.ecore.EReference reference)

  Determines if we should ignore a reference for diff detection.

  Default is to ignore references marked either

  - Containment
  - Container
  - Transient
  - Derived

  Clients should override this if they wish to ignore other references.

  Parameters:
    `reference` - Reference to determine whether it should be ignored.
  Returns:
    `True` if reference has to be ignored, `False` otherwise.

Copyright 2006 IBM Corporation and others. All Rights Reserved.