public class DefaultMatchEngine extends Object implements IMatchEngine
scope
as input,
iterates over its left
, right
and
origin
roots and delegates to IResourceMatcher
s and
IEObjectMatcher
s in order to create the result Comparison
model for this scope.IMatchEngine.Factory
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE
Default max size of the EObject's URI loading cache.
|
Constructor and Description |
---|
DefaultMatchEngine(IEObjectMatcher matcher,
IComparisonFactory comparisonFactory)
This default engine delegates the pairing of EObjects to an
IEObjectMatcher . |
Modifier and Type | Method and Description |
---|---|
static IMatchEngine |
create(UseIdentifiers useIDs)
Helper creator method that instantiate a
DefaultMatchEngine that will use identifiers as
specified by the given useIDs enumeration. |
static IMatchEngine |
create(UseIdentifiers useIDs,
WeightProvider.Descriptor.Registry weightProviderRegistry)
Helper creator method that instantiate a
DefaultMatchEngine that will use identifiers as
specified by the given useIDs enumeration. |
static IEObjectMatcher |
createDefaultEObjectMatcher(UseIdentifiers useIDs)
Creates and configures an
IEObjectMatcher with the strategy given by useIDs . |
static IEObjectMatcher |
createDefaultEObjectMatcher(UseIdentifiers useIDs,
WeightProvider.Descriptor.Registry weightProviderRegistry)
Creates and configures an
IEObjectMatcher with the strategy given by useIDs . |
protected IResourceMatcher |
createResourceMatcher()
This will be used to create the resource matcher that will be used by this match engine.
|
protected IEObjectMatcher |
getEObjectMatcher()
Returns the EObject matcher associated with this match engine.
|
protected void |
match(Comparison comparison,
IComparisonScope scope,
EObject left,
EObject right,
EObject origin,
Monitor monitor)
This will query the scope for the given
EObject s' children, then delegate to an
IEObjectMatcher to compute the Matches. |
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 of
left , right and origin . |
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 an
IEObjectMatcher 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 given
ResourceSet s. |
Comparison |
match(IComparisonScope scope,
Monitor monitor)
This is the entry point of a Comparison process.
|
public static final int DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE
public DefaultMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory)
IEObjectMatcher
.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.public Comparison match(IComparisonScope scope, Monitor monitor)
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.
match
in interface IMatchEngine
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 cancellationComparison
model with all matches determined.IMatchEngine.match(org.eclipse.emf.compare.scope.IComparisonScope,
org.eclipse.emf.common.util.Monitor)
protected void match(Comparison comparison, IComparisonScope scope, Notifier left, Notifier right, Notifier origin, Monitor monitor)
left
, right
and origin
.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 left Notifier
.right
- The right Notifier
.origin
- The common ancestor of left
and right
. Can be null
.monitor
- The monitor to report progress or to check for cancellationprotected void match(Comparison comparison, IComparisonScope scope, ResourceSet left, ResourceSet right, ResourceSet origin, Monitor monitor)
ResourceSet
s. This default implementation will query the
comparison scope for these resource sets children, then delegate to an IResourceMatcher
to
determine the resource mappings.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 left ResourceSet
.right
- The right ResourceSet
.origin
- The common ancestor of left
and right
. Can be null
.monitor
- The monitor to report progress or to check for cancellationprotected void match(Comparison comparison, IComparisonScope scope, Resource left, Resource right, Resource origin, Monitor monitor)
IEObjectMatcher
to determine the EObject matches.
We expect at least two of the given resources not to be null
.
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 left Resource
. Can be null
.right
- The right Resource
. Can be null
.origin
- The common ancestor of left
and right
. Can be null
.monitor
- The monitor to report progress or to check for cancellationprotected void match(Comparison comparison, IComparisonScope scope, EObject left, EObject right, EObject origin, Monitor monitor)
EObject
s' children, then delegate to an
IEObjectMatcher
to compute the Matches.
We expect at least the left
and right
EObjects not to be null
.
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 left EObject
.right
- The right EObject
.origin
- The common ancestor of left
and right
.monitor
- The monitor to report progress or to check for cancellation.protected IResourceMatcher createResourceMatcher()
IResourceMatcher
that can be used to retrieve the MatchResource
s for this
comparison.protected final IEObjectMatcher getEObjectMatcher()
public static IMatchEngine create(UseIdentifiers useIDs)
DefaultMatchEngine
that will use identifiers as
specified by the given useIDs
enumeration.useIDs
- the kinds of matcher to use.DefaultMatchEngine
instance.public static IMatchEngine create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
DefaultMatchEngine
that will use identifiers as
specified by the given useIDs
enumeration.useIDs
- the kinds of matcher to use.weightProviderRegistry
- the match engine needs a WeightProvider in case of this match engine do not use identifiers.DefaultMatchEngine
instance.public static IEObjectMatcher createDefaultEObjectMatcher(UseIdentifiers useIDs)
IEObjectMatcher
with the strategy given by useIDs
. The
cache
will be used to cache some expensive computation (should better a LoadingCache).useIDs
- which strategy the return IEObjectMatcher must follow.public static IEObjectMatcher createDefaultEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry)
IEObjectMatcher
with the strategy given by useIDs
. The
cache
will be used to cache some expensive computation (should better a LoadingCache).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.
Copyright (c) 2006, 2014 Obeo and others. All rights reserved.