org.eclipse.emf.compare.diff.engine.check
Class AbstractCheck

java.lang.Object
  extended by org.eclipse.emf.compare.diff.engine.check.AbstractCheck
Direct Known Subclasses:
AttributesCheck, ReferencesCheck

public abstract class AbstractCheck
extends java.lang.Object

This provides a base implementation for the different checks that clients can need to call in specific differencing engines implementations.

Since:
1.0

Field Summary
protected static int ANCESTOR_OBJECT
          Allows retrieval of the ancestor matched object.
protected  org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer crossReferencer
          If we're currently doing a resourceSet differencing, this will have been initialized with the whole MatchResourceSet.
protected static int LEFT_OBJECT
          Allows retrieval of the left matched object.
protected static int RIGHT_OBJECT
          Allows retrieval of the right matched object.
 
Constructor Summary
AbstractCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)
          Instantiates the checker given the current crossreferencing members of the diff engine.
 
Method Summary
protected  java.util.List<java.lang.Object> convertFeatureMapList(java.util.List<?> input)
          This will return a list containing only EObjects.
protected  org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from)
          Return the left or right matched EObject from the one given.
protected  org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from, int side)
          Return the specified matched EObject from the one given.
protected  boolean isUnmatched(org.eclipse.emf.ecore.EObject element)
          Returns true if the given element corresponds to an UnmatchedElement, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANCESTOR_OBJECT

protected static final int ANCESTOR_OBJECT
Allows retrieval of the ancestor matched object.

See Also:
Constant Field Values

LEFT_OBJECT

protected static final int LEFT_OBJECT
Allows retrieval of the left matched object.

See Also:
Constant Field Values

RIGHT_OBJECT

protected static final int RIGHT_OBJECT
Allows retrieval of the right matched object.

See Also:
Constant Field Values

crossReferencer

protected final org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer crossReferencer
If we're currently doing a resourceSet differencing, this will have been initialized with the whole MatchResourceSet.

Constructor Detail

AbstractCheck

public AbstractCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)
Instantiates the checker given the current crossreferencing members of the diff engine.

Parameters:
referencer - This cross referencer has been initialized with the whole MatchResourceSet and can be used to retrieve matched EObjects towards other resources.
Method Detail

convertFeatureMapList

protected final java.util.List<java.lang.Object> convertFeatureMapList(java.util.List<?> input)
This will return a list containing only EObjects. This is mainly aimed at FeatureMap.Entry values.

Parameters:
input - List that is to be converted.
Returns:
A list containing only EObjects.
Since:
1.0

getMatchedEObject

protected final org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from)
Return the left or right matched EObject from the one given. More specifically, this will return the left matched element if the given EObject is the right one, or the right matched element if the given EObject is either the left or the origin one.

Parameters:
from - The original EObject.
Returns:
The matched EObject.

getMatchedEObject

protected final org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from,
                                                                int side)
                                                         throws java.lang.IllegalArgumentException
Return the specified matched EObject from the one given.

Parameters:
from - The original EObject.
side - side of the object we seek. Must be one of .
Returns:
The matched EObject.
Throws:
java.lang.IllegalArgumentException - Thrown if side is invalid.

isUnmatched

protected final boolean isUnmatched(org.eclipse.emf.ecore.EObject element)
Returns true if the given element corresponds to an UnmatchedElement, false otherwise.

Parameters:
element - The element for which we need to know whether it is unmatched.
Returns:
true if the given element corresponds to an UnmatchedElement, false otherwise.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.