public class IdentifierEObjectMatcher extends Object implements IEObjectMatcher
IEObjectMatcher
will create Match
es based on the input EObjects
identifiers (either XMI:ID or attribute ID) alone.Modifier and Type | Class and Description |
---|---|
static class |
IdentifierEObjectMatcher.DefaultIDFunction
The default function used to retrieve IDs from EObject.
|
Constructor and Description |
---|
IdentifierEObjectMatcher()
Creates an ID based matcher without any delegate.
|
IdentifierEObjectMatcher(com.google.common.base.Function<EObject,String> idComputation)
Creates an ID based matcher computing the ID with the given function.
|
IdentifierEObjectMatcher(IEObjectMatcher delegateWhenNoID)
Creates an ID based matcher with the given delegate when no ID can be found.
|
IdentifierEObjectMatcher(IEObjectMatcher delegateWhenNoID,
com.google.common.base.Function<EObject,String> idComputation)
Create an ID based matcher with a delegate which is going to be called when no ID is found for a given
EObject.
|
Modifier and Type | Method and Description |
---|---|
void |
createMatches(Comparison comparison,
Iterator<? extends EObject> leftEObjects,
Iterator<? extends EObject> rightEObjects,
Iterator<? extends EObject> originEObjects,
Monitor monitor)
This will be called by the match engine to determine matches between EObjects.
|
protected void |
doDelegation(Comparison comparison,
List<EObject> leftEObjectsNoID,
List<EObject> rightEObjectsNoID,
List<EObject> originEObjectsNoID,
Monitor monitor)
Execute matching process for the delegated IEObjectMatcher.
|
protected EObject |
getParentEObject(EObject eObject)
This method is used to determine the parent objects during matching.
|
protected Set<Match> |
matchPerId(Iterator<? extends EObject> leftEObjects,
Iterator<? extends EObject> rightEObjects,
Iterator<? extends EObject> originEObjects,
List<EObject> leftEObjectsNoID,
List<EObject> rightEObjectsNoID,
List<EObject> originEObjectsNoID)
Matches the EObject per ID.
|
public IdentifierEObjectMatcher()
public IdentifierEObjectMatcher(IEObjectMatcher delegateWhenNoID)
delegateWhenNoID
- the matcher to delegate to when no ID is found.public IdentifierEObjectMatcher(com.google.common.base.Function<EObject,String> idComputation)
idComputation
- the function used to compute the ID.public IdentifierEObjectMatcher(IEObjectMatcher delegateWhenNoID, com.google.common.base.Function<EObject,String> idComputation)
delegateWhenNoID
- the delegate matcher to use when no ID is found.idComputation
- the function used to compute the ID.public void createMatches(Comparison comparison, Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, Monitor monitor)
The implementation should update the given comparison object by adding the Matches it detect. These matches should include both matching and unmatchings EObjects (i.e. EObjects that can be matched in all three lists, EObjects that cna be matched in only two of the three lists, and EObjects that can only be found in one of the three.
createMatches
in interface IEObjectMatcher
comparison
- the comparison to update.leftEObjects
- An iterator over the EObjects that could be found in the left side.rightEObjects
- An iterator over the EObjects that could be found in the right side.originEObjects
- And iterator over the EObject that may be considered ancestors of the couples that can be
detected in the left and right sides.monitor
- The monitor to report progress or to check for cancellationprotected void doDelegation(Comparison comparison, List<EObject> leftEObjectsNoID, List<EObject> rightEObjectsNoID, List<EObject> originEObjectsNoID, Monitor monitor)
comparison
- the comparison object that contains the matchesmonitor
- the monitor instance to track the matching progressleftEObjectsNoID
- remaining left objects after matchingrightEObjectsNoID
- remaining right objects after matchingoriginEObjectsNoID
- remaining origin objects after matchingprotected Set<Match> matchPerId(Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, List<EObject> leftEObjectsNoID, List<EObject> rightEObjectsNoID, List<EObject> originEObjectsNoID)
leftEObjects
- the objects to match (left side).rightEObjects
- the objects to match (right side).originEObjects
- the objects to match (origin side).leftEObjectsNoID
- remaining left objects after matchingrightEObjectsNoID
- remaining right objects after matchingoriginEObjectsNoID
- remaining origin objects after matchingprotected EObject getParentEObject(EObject eObject)
eObject
. Can be overwritten by clients to still
allow proper matching when using a more complex architecture.eObject
- The EObject
for which the parent object is to determine.eObject
.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.