Package org.eclipse.emf.compare.match
Class DefaultMatchEngine
- java.lang.Object
-
- org.eclipse.emf.compare.match.DefaultMatchEngine
-
- All Implemented Interfaces:
IMatchEngine
public class DefaultMatchEngine extends Object implements IMatchEngine
The Match engine orchestrates the matching process : it takes anscope
as input, iterates over itsleft
,right
andorigin
roots and delegates toIResourceMatcher
s andIEObjectMatcher
s in order to create the resultComparison
model for this scope.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emf.compare.match.IMatchEngine
IMatchEngine.Factory
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE
Default max size of the EObject's URI loading cache.
-
Constructor Summary
Constructors Constructor Description DefaultMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory)
This default engine delegates the pairing of EObjects to anIEObjectMatcher
.DefaultMatchEngine(IEObjectMatcher eObjectMatcher, IResourceMatcher resourceMatcher, IComparisonFactory comparisonFactory)
This default engine delegates the pairing of EObjects to anIEObjectMatcher
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IMatchEngine
create(UseIdentifiers useIDs)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.static IMatchEngine
create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.static IMatchEngine
create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, Collection<IResourceMatchingStrategy> strategies)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.static IMatchEngine
create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, EqualityHelperExtensionProvider.Descriptor.Registry equalityHelperExtensionProviderRegistry, Collection<IResourceMatchingStrategy> strategies)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.static IEObjectMatcher
createDefaultEObjectMatcher(UseIdentifiers useIDs)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
.static IEObjectMatcher
createDefaultEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
.static IEObjectMatcher
createDefaultEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, EqualityHelperExtensionProvider.Descriptor.Registry equalityHelperExtensionProviderRegistry)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
.protected IResourceMatcher
createResourceMatcher()
Deprecated.useDefaultMatchEngine
constructor withStrategyResourceMatcher
parameter instead.protected IEObjectMatcher
getEObjectMatcher()
Returns the EObject matcher associated with this match engine.protected IResourceMatcher
getResourceMatcher()
Returns the Resource matcher associated with this match engine.protected void
match(Comparison comparison, IComparisonScope scope, Notifier left, Notifier right, Notifier origin, Monitor monitor)
This methods will delegate to the proper "match(T, T, T)" implementation according to the types ofleft
,right
andorigin
.protected void
match(Comparison comparison, IComparisonScope scope, EObject left, EObject right, EObject origin, Monitor monitor)
This will query the scope for the givenEObject
s' children, then delegate to anIEObjectMatcher
to compute the Matches.protected void
match(Comparison comparison, IComparisonScope scope, Resource left, Resource right, Resource origin, Monitor monitor)
This will only query the scope for the given Resources' children, then delegate to anIEObjectMatcher
to determine the EObject matches.protected void
match(Comparison comparison, IComparisonScope scope, ResourceSet left, ResourceSet right, ResourceSet origin, Monitor monitor)
This will be used to match the givenResourceSet
s.Comparison
match(IComparisonScope scope, Monitor monitor)
This is the entry point of a Comparison process.
-
-
-
Field Detail
-
DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE
public static final int DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE
Default max size of the EObject's URI loading cache.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultMatchEngine
public DefaultMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory)
This default engine delegates the pairing of EObjects to anIEObjectMatcher
.- Parameters:
matcher
- The matcher that will be in charge of pairing EObjects together for this comparison process.comparisonFactory
- factory that will be use to instantiate Comparison as return by match() methods.- Since:
- 3.0
-
DefaultMatchEngine
public DefaultMatchEngine(IEObjectMatcher eObjectMatcher, IResourceMatcher resourceMatcher, IComparisonFactory comparisonFactory)
This default engine delegates the pairing of EObjects to anIEObjectMatcher
.- Parameters:
eObjectMatcher
- The matcher that will be in charge of pairing EObjects together for this comparison process.resourceMatcher
- The matcher that will be in charge of pairing EObjects together for this comparison process.comparisonFactory
- factory that will be use to instantiate Comparison as return by match() methods.- Since:
- 3.2
-
-
Method Detail
-
match
public Comparison match(IComparisonScope scope, Monitor monitor)
This is the entry point of a Comparison process. It is expected to use the provided scope in order to determine all objects that need to be matched.The returned Comparison should include both matched an unmatched objects. It is not the match engine's responsibility to determine differences between objects, only to match them together.
- Specified by:
match
in interfaceIMatchEngine
- Parameters:
scope
- The comparison scope that should be used by this engine to determine the objects to match.monitor
- The monitor to report progress or to check for cancellation- Returns:
- An initialized
Comparison
model with all matches determined. - See Also:
IMatchEngine.match(org.eclipse.emf.compare.scope.IComparisonScope, org.eclipse.emf.common.util.Monitor)
-
match
protected void match(Comparison comparison, IComparisonScope scope, Notifier left, Notifier right, Notifier origin, Monitor monitor)
This methods will delegate to the proper "match(T, T, T)" implementation according to the types ofleft
,right
andorigin
.- Parameters:
comparison
- The comparison to which will be added detected matches.scope
- The comparison scope that should be used by this engine to determine the objects to match.left
- The leftNotifier
.right
- The rightNotifier
.origin
- The common ancestor ofleft
andright
. Can benull
.monitor
- The monitor to report progress or to check for cancellation
-
match
protected void match(Comparison comparison, IComparisonScope scope, ResourceSet left, ResourceSet right, ResourceSet origin, Monitor monitor)
This will be used to match the givenResourceSet
s. This default implementation will query the comparison scope for these resource sets children, then delegate to anIResourceMatcher
to determine the resource mappings.- Parameters:
comparison
- The comparison to which will be added detected matches.scope
- The comparison scope that should be used by this engine to determine the objects to match.left
- The leftResourceSet
.right
- The rightResourceSet
.origin
- The common ancestor ofleft
andright
. Can benull
.monitor
- The monitor to report progress or to check for cancellation
-
match
protected void match(Comparison comparison, IComparisonScope scope, Resource left, Resource right, Resource origin, Monitor monitor)
This will only query the scope for the given Resources' children, then delegate to anIEObjectMatcher
to determine the EObject matches.We expect at least two of the given resources not to be
null
.- Parameters:
comparison
- The comparison to which will be added detected matches.scope
- The comparison scope that should be used by this engine to determine the objects to match.left
- The leftResource
. Can benull
.right
- The rightResource
. Can benull
.origin
- The common ancestor ofleft
andright
. Can benull
.monitor
- The monitor to report progress or to check for cancellation
-
match
protected void match(Comparison comparison, IComparisonScope scope, EObject left, EObject right, EObject origin, Monitor monitor)
This will query the scope for the givenEObject
s' children, then delegate to anIEObjectMatcher
to compute the Matches.We expect at least the
left
andright
EObjects not to benull
.- Parameters:
comparison
- The comparison to which will be added detected matches.scope
- The comparison scope that should be used by this engine to determine the objects to match.left
- The leftEObject
.right
- The rightEObject
.origin
- The common ancestor ofleft
andright
.monitor
- The monitor to report progress or to check for cancellation.
-
createResourceMatcher
@Deprecated protected IResourceMatcher createResourceMatcher()
Deprecated.useDefaultMatchEngine
constructor withStrategyResourceMatcher
parameter instead.This will be used to create the resource matcher that will be used by this match engine.- Returns:
- An
IResourceMatcher
that can be used to retrieve theMatchResource
s for this comparison.
-
getResourceMatcher
protected final IResourceMatcher getResourceMatcher()
Returns the Resource matcher associated with this match engine.- Returns:
- The Resource matcher associated with this match engine.
-
getEObjectMatcher
protected final IEObjectMatcher getEObjectMatcher()
Returns the EObject matcher associated with this match engine.- Returns:
- The EObject matcher associated with this match engine.
-
create
public static IMatchEngine create(UseIdentifiers useIDs)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.- Parameters:
useIDs
- the kinds of matcher to use.- Returns:
- a new
DefaultMatchEngine
instance.
-
create
public static IMatchEngine create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.- Parameters:
useIDs
- the kinds of matcher to use.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.- Returns:
- a new
DefaultMatchEngine
instance.
-
create
public static IMatchEngine create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, Collection<IResourceMatchingStrategy> strategies)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.- Parameters:
useIDs
- the kinds of matcher to use.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.strategies
- the matching strategies you want to use for the match step.- Returns:
- a new
DefaultMatchEngine
instance.
-
create
public static IMatchEngine create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, EqualityHelperExtensionProvider.Descriptor.Registry equalityHelperExtensionProviderRegistry, Collection<IResourceMatchingStrategy> strategies)
Helper creator method that instantiate aDefaultMatchEngine
that will use identifiers as specified by the givenuseIDs
enumeration.- Parameters:
useIDs
- the kinds of matcher to use.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.equalityHelperExtensionProviderRegistry
- the match engine may need a Equality Helper Extensionstrategies
- the matching strategies you want to use for the match step.- Returns:
- a new
DefaultMatchEngine
instance.
-
createDefaultEObjectMatcher
public static IEObjectMatcher createDefaultEObjectMatcher(UseIdentifiers useIDs)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
. Thecache
will be used to cache some expensive computation (should better a LoadingCache).- Parameters:
useIDs
- which strategy the return IEObjectMatcher must follow.- Returns:
- a new IEObjectMatcher.
-
createDefaultEObjectMatcher
public static IEObjectMatcher createDefaultEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
. Thecache
will be used to cache some expensive computation (should better a LoadingCache).- Parameters:
useIDs
- which strategy the return IEObjectMatcher must follow.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.- Returns:
- a new IEObjectMatcher.
-
createDefaultEObjectMatcher
public static IEObjectMatcher createDefaultEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry, EqualityHelperExtensionProvider.Descriptor.Registry equalityHelperExtensionProviderRegistry)
Creates and configures anIEObjectMatcher
with the strategy given byuseIDs
. Thecache
will be used to cache some expensive computation (should better a LoadingCache).- Parameters:
useIDs
- which strategy the return IEObjectMatcher must follow.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.equalityHelperExtensionProviderRegistry
- the match engine may need a Equality helper extension.- Returns:
- a new IEObjectMatcher.
-
-