|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.compare.diff.engine.GenericDiffEngine
public class GenericDiffEngine
This class is useful when one wants to determine a diff from a matching model.
Field Summary | |
---|---|
protected static int |
ANCESTOR_OBJECT
Allows retrieval of the ancestor matched object. |
protected static int |
LEFT_OBJECT
Allows retrieval of the left matched object. |
protected org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer |
matchCrossReferencer
If we're currently doing a resourceSet differencing, this will have been initialized with the whole MatchResourceSet. |
protected static int |
RIGHT_OBJECT
Allows retrieval of the right matched object. |
Constructor Summary | |
---|---|
GenericDiffEngine()
|
Method Summary | |
---|---|
protected void |
addInContainerPackage(DiffGroup root,
DiffElement operation,
org.eclipse.emf.ecore.EObject targetParent)
Looks for an already created diff group in order to add the operation, if none
exists, create one where the operation belongs to. |
protected void |
checkAttributesUpdates(DiffGroup root,
Match2Elements mapping)
Deprecated. Override AttributesCheck.checkAttributesUpdates(DiffGroup, Match2Elements) and
return your overriden implementation through getAttributesChecker() . |
protected void |
checkAttributesUpdates(DiffGroup root,
Match3Elements mapping)
Deprecated. Override AttributesCheck.checkAttributesUpdates(DiffGroup, Match3Elements) and
return your overriden implementation through getAttributesChecker() . |
protected void |
checkContainmentUpdate(DiffGroup current,
Match2Elements matchElement)
This will check whether the left and right element are contained in the same containment reference and create a difference if need be. |
protected void |
checkContainmentUpdate(DiffGroup root,
Match3Elements matchElement)
This will check whether the left and right element are contained in the same containment reference and create a difference if need be. |
protected void |
checkForDiffs(DiffGroup current,
Match2Elements match)
This will call all the different checks we need to call for when computing the diff. |
protected void |
checkForDiffs(DiffGroup current,
Match3Elements match)
This will call all the different checks we need to call for when computing the diff. |
protected void |
checkMoves(DiffGroup root,
Match2Elements matchElement)
This will check if the elements matched by a given Match2Elements have been moved. |
protected void |
checkMoves(DiffGroup root,
Match3Elements matchElement)
This will check if the elements matched by a given Match3Element have been moved since the
models common ancestor. |
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)
Deprecated. Replaced by ReferencesCheck . |
protected void |
checkReferencesUpdates(DiffGroup root,
Match2Elements mapping)
Deprecated. Override ReferencesCheck.checkReferencesUpdates(DiffGroup, Match2Elements) and
return your overriden implementation through getReferencesChecker() . |
protected void |
checkReferencesUpdates(DiffGroup root,
Match3Elements mapping)
Deprecated. Override ReferencesCheck.checkReferencesUpdates(DiffGroup, Match3Elements) and
return your overriden implementation through getReferencesChecker() . |
DiffModel |
doDiff(MatchModel match)
Return a diffmodel created using the match model. |
DiffModel |
doDiff(MatchModel match,
boolean threeWay)
Return a diffmodel created using the match model. |
DiffModel |
doDiffResourceSet(MatchModel match,
boolean threeWay,
org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer crossReferencer)
Return a diffmodel created using the given match model. |
protected DiffGroup |
doDiffThreeWay(MatchModel match)
The diff computing for three way comparisons is handled here. |
protected DiffGroup |
doDiffTwoWay(MatchModel match)
The diff computing for two way comparisons is handled here. |
protected AttributesCheck |
getAttributesChecker()
Returns the implementation of a AbstractCheck
responsible for the verification of updates on attribute values. |
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 ReferencesCheck |
getReferencesChecker()
Returns the implementation of a AbstractCheck
responsible for the verification of updates on reference values. |
protected void |
log(java.lang.Exception e)
Log an error. |
protected void |
processUnmatchedElements(DiffGroup diffRoot,
java.util.List<UnmatchElement> unmatched)
This will process the unmatched elements list and create the appropriate
DiffElement s. |
void |
reset()
This will be called with each access from the service to the singleton instance of this engine. |
protected boolean |
shouldBeIgnored(org.eclipse.emf.ecore.EAttribute attribute)
Deprecated. Replaced by AttributesCheck . |
protected boolean |
shouldBeIgnored(org.eclipse.emf.ecore.EReference reference)
Deprecated. Replaced by ReferencesCheck . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int ANCESTOR_OBJECT
protected static final int LEFT_OBJECT
protected static final int RIGHT_OBJECT
protected org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer matchCrossReferencer
Constructor Detail |
---|
public GenericDiffEngine()
Method Detail |
---|
public DiffModel doDiff(MatchModel match)
doDiff
in interface IDiffEngine
match
- The matching model.
IDiffEngine.doDiff(org.eclipse.emf.compare.match.metamodel.MatchModel)
public DiffModel doDiff(MatchModel match, boolean threeWay)
doDiff
in interface IDiffEngine
match
- the matching modelthreeWay
- True
if we're computing a three way comparison, False
otherwise.
IDiffEngine.doDiff(org.eclipse.emf.compare.match.metamodel.MatchModel,
boolean)
public DiffModel doDiffResourceSet(MatchModel match, boolean threeWay, org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer crossReferencer)
crossReferencer
has been
initialized on the whole MatchResourceSet.
doDiffResourceSet
in interface IDiffEngine
match
- the matching modelthreeWay
- True
if we're computing a three way comparison, False
otherwise.crossReferencer
- This cross referencer has been initialized with the whole MatchResourceSet and can be used
to retrieve matched EObjects towards other resources.
IDiffEngine.doDiffResourceSet(org.eclipse.emf.compare.match.metamodel.MatchModel,
boolean, org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer)
public void reset()
reset
in interface IDiffEngine
IDiffEngine.reset()
protected void addInContainerPackage(DiffGroup root, DiffElement operation, org.eclipse.emf.ecore.EObject targetParent)
diff group
in order to add the operation, if none
exists, create one where the operation belongs to.
root
- root
of the DiffModel
.operation
- Operation to add to the DiffModel
.targetParent
- Parent EObject
for the operation.protected AttributesCheck getAttributesChecker()
AbstractCheck
responsible for the verification of updates on attribute values.
AbstractCheck
responsible for the verification of updates on attribute values.protected ReferencesCheck getReferencesChecker()
AbstractCheck
responsible for the verification of updates on reference values.
AbstractCheck
responsible for the verification of updates on reference values.@Deprecated protected void checkAttributesUpdates(DiffGroup root, Match2Elements mapping) throws FactoryException
AttributesCheck.checkAttributesUpdates(DiffGroup, Match2Elements)
and
return your overriden implementation through getAttributesChecker()
.
mapping
's two elements to check if any
of them has been modified.
root
- root
of the DiffElement
to create if one of the attributes has
actually been changed.mapping
- This contains the mapping information about the elements we need to check.
FactoryException
- Thrown if one of the checks fails.@Deprecated protected void checkAttributesUpdates(DiffGroup root, Match3Elements mapping) throws FactoryException
AttributesCheck.checkAttributesUpdates(DiffGroup, Match3Elements)
and
return your overriden implementation through getAttributesChecker()
.
mapping
's three elements to check if
any of them has been modified.
root
- root
of the DiffElement
to create if one of the attribute has
actually been changed.mapping
- This contains the mapping information about the elements we need to check for a move.
FactoryException
- Thrown if one of the checks fails.protected void checkContainmentUpdate(DiffGroup current, Match2Elements matchElement)
current
- DiffGroup
under which the new differences will be added.matchElement
- This contains the mapping information about the elements we need to check for a containment
reference update.protected void checkContainmentUpdate(DiffGroup root, Match3Elements matchElement)
root
- DiffGroup
under which the new differences will be added.matchElement
- This contains the mapping information about the elements we need to check for a containment
reference update.protected void checkForDiffs(DiffGroup current, Match2Elements match) throws FactoryException
current
- current DiffGroup
under which the new differences will be added.match
- This contains the mapping information about the elements we need to check for a move.
FactoryException
- Thrown if one of the checks fails somehow.protected void checkForDiffs(DiffGroup current, Match3Elements match) throws FactoryException
current
- current DiffGroup
under which the new differences will be added.match
- This contains the mapping information about the elements we need to check for a move.
FactoryException
- Thrown if one of the checks fails somehow.protected void checkMoves(DiffGroup root, Match2Elements matchElement)
Match2Elements
have been moved.
root
- root
of the DiffElement
to create if the elements have actually
been moved.matchElement
- This contains the mapping information about the elements we need to check for a move.protected void checkMoves(DiffGroup root, Match3Elements matchElement)
Match3Element
have been moved since the
models common ancestor.
root
- root
of the DiffElement
to create if the elements have actually
been moved.matchElement
- This contains the mapping information about the elements we need to check for a move.@Deprecated 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
ReferencesCheck
.
reference.isMany()
and reference.isOrdered()
always return true here for the
generic diff engine and the tests won't be made.
root
- Root
of the DiffElement
s to create.reference
- EReference
to check for modifications.leftElement
- Element corresponding to the final value for the given reference.rightElement
- Element corresponding to the initial value for the given reference.addedReferences
- Contains the created differences for added reference values.removedReferences
- Contains the created differences for removed reference values.
FactoryException
- Thrown if we cannot fetch the references' values.@Deprecated protected void checkReferencesUpdates(DiffGroup root, Match2Elements mapping) throws FactoryException
ReferencesCheck.checkReferencesUpdates(DiffGroup, Match2Elements)
and
return your overriden implementation through getReferencesChecker()
.
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.
root
- root
of the DiffElement
to create.mapping
- Contains informations about the left and right model elements we have to compare.
FactoryException
- Thrown if we cannot fetch the references' values.@Deprecated protected void checkReferencesUpdates(DiffGroup root, Match3Elements mapping) throws FactoryException
ReferencesCheck.checkReferencesUpdates(DiffGroup, Match3Elements)
and
return your overriden implementation through getReferencesChecker()
.
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.
root
- root
of the DiffElement
to create.mapping
- Contains informations about the left, right and origin model elements we have to compare.
FactoryException
- Thrown if we cannot fetch the references' values.protected DiffGroup doDiffThreeWay(MatchModel match)
match
- match model
we'll be using to compute the differences.
root
of the DiffModel
computed from the given MatchModel
.protected DiffGroup doDiffTwoWay(MatchModel match)
match
- match model
we'll be using to compute the differences.
root
of the DiffModel
computed from the given MatchModel
.protected final org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from)
EObject
is the right one, or the right matched element if the
given EObject
is either the left or the origin one.
from
- The original EObject
.
EObject
.protected final org.eclipse.emf.ecore.EObject getMatchedEObject(org.eclipse.emf.ecore.EObject from, int side) throws java.lang.IllegalArgumentException
EObject
from the one given.
from
- The original EObject
.side
- side of the object we seek. Must be one of
.
java.lang.IllegalArgumentException
- Thrown if side
is invalid.protected void processUnmatchedElements(DiffGroup diffRoot, java.util.List<UnmatchElement> unmatched)
unmatched elements
list and create the appropriate
DiffElement
s.
diffRoot
- DiffGroup
under which to create the DiffElement
s.unmatched
- The MatchModel's UnmatchElement
s.@Deprecated protected boolean shouldBeIgnored(org.eclipse.emf.ecore.EAttribute attribute)
AttributesCheck
.
Default is to ignore attributes marked either
Clients should override this if they wish to ignore other attributes.
attribute
- Attribute to determine whether it should be ignored.
True
if attribute has to be ignored, False
otherwise.@Deprecated protected boolean shouldBeIgnored(org.eclipse.emf.ecore.EReference reference)
ReferencesCheck
.
Default is to ignore references marked either
Clients should override this if they wish to ignore other references.
reference
- Reference to determine whether it should be ignored.
True
if reference has to be ignored, False
otherwise.protected void log(java.lang.Exception e)
e
- any Exception.
|
Copyright 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |