Package org.eclipse.emf.compare
Class EMFCompare
java.lang.Object
org.eclipse.emf.compare.EMFCompare
This class serves as the main entry point of a comparison. When all that is wanted is a basic comparison of
two or three notifiers, a comparison using all of the default configuration can be launched through
EMFCompare.builder().build().compare(EMFCompare.createDefaultScope(left, right, origin))
.
When in need of a more customized comparison, the API can be used through chained calls. For example, if
you need to compare two notifiers (left
and right
) while ignoring their identifiers, with a
given progress monitor (call it progress
), you can do so through :
EMFCompare.builder().setMatchEngine(DefaultMatchEngine.create(UseIdentifiers.NEVER)).build().compare(EMFCompare.createDefaultScope(left, right), new BasicMonitor())
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A Builder pattern to instantiate EMFCompare objects. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The value for diagnostics coming from EMF compare. -
Constructor Summary
ModifierConstructorDescriptionprotected
EMFCompare
(IMatchEngine.Factory.Registry matchEngineFactoryRegistry, IDiffEngine diffEngine, IReqEngine reqEngine, IEquiEngine equiEngine, IConflictDetector conflictDetector, IPostProcessor.Descriptor.Registry<?> postProcessorFactoryRegistry) Creates a new EMFCompare object able to compare Notifier with the help of given engines. -
Method Summary
Modifier and TypeMethodDescriptionstatic EMFCompare.Builder
builder()
Creates a new builder to configure the creation of a new EMFCompare object.compare
(IComparisonScope scope) Computes and returns a new Comparison object representation the differences between Notifier in the givescope
.compare
(IComparisonScope scope, Monitor monitor) Launches the comparison with the given scope and reporting progress to the givenmonitor
.static IComparisonScope
createDefaultScope
(Notifier left, Notifier right) Deprecated.static IComparisonScope
createDefaultScope
(Notifier left, Notifier right, Notifier origin) Deprecated.this was only a delegation to the publicly accessibleDefaultComparisonScope
... it will be removed in a subsequent release.
-
Field Details
-
DIAGNOSTIC_SOURCE
The value for diagnostics coming from EMF compare.- Since:
- 3.2
- See Also:
-
-
Constructor Details
-
EMFCompare
protected EMFCompare(IMatchEngine.Factory.Registry matchEngineFactoryRegistry, IDiffEngine diffEngine, IReqEngine reqEngine, IEquiEngine equiEngine, IConflictDetector conflictDetector, IPostProcessor.Descriptor.Registry<?> postProcessorFactoryRegistry) Creates a new EMFCompare object able to compare Notifier with the help of given engines.- Parameters:
matchEngineFactoryRegistry
-IMatchEngine.Factory.Registry
to use to find a match engine factory to compute comparisondiffEngine
- IDiffEngine to use to compute comparisonreqEngine
- IReqEngine to use to compute comparisonequiEngine
- IEquiEngine to use to compute comparisonconflictDetector
- IConflictDetector to use to compute comparisonpostProcessorFactoryRegistry
- PostProcessorRegistry to use to find an IPostProcessor
-
-
Method Details
-
createDefaultScope
Deprecated.this was only a delegation to the publicly accessibleDefaultComparisonScope
... it will be removed in a subsequent release.Creates a default comparison scope given its left and right notifiers.The default comparison scope covers all proper content of the given notifiers, i.e any element contained directly under that notifier.
- Parameters:
left
- The left notifier of this scope.right
- The right notifier of this scope.- Returns:
- The newly created scope, as used as default by EMF Compare.
- See Also:
-
createDefaultScope
@Deprecated public static IComparisonScope createDefaultScope(Notifier left, Notifier right, Notifier origin) Deprecated.this was only a delegation to the publicly accessibleDefaultComparisonScope
... it will be removed in a subsequent release.Creates the default comparison scope given its left and right notifiers, along with the common ancestor of both.The default comparison scope covers all proper content of the given notifiers, i.e any element contained directly under that notifier.
- Parameters:
left
- The left notifier of this scope.right
- The right notifier of this scope.origin
- The common ancestor ofleft
andright
.- Returns:
- The newly created scope, as used as default by EMF Compare.
- See Also:
-
compare
Computes and returns a new Comparison object representation the differences between Notifier in the givescope
.- Parameters:
scope
- the scope to compare.- Returns:
- the result of the comparison.
-
compare
Launches the comparison with the given scope and reporting progress to the givenmonitor
.- Parameters:
scope
- the scope to compare, must not benull
.monitor
- the monitor to report progress to, must not benull
.done()
will be called on it. If the monitor is cancelled, the result may benull
(in rare cases) or contain a Diagnostic that indicates cancellation. Note: The given monitor is expected to use 10 ticks for 100%.- Returns:
- The result of the comparison, which is never null but may be empty if the monitor has been canceled immediately after entering this method. The returned comparison will contain a relevant diagnostic indicating if the comparison has been canceled or if problems have occurred during its computation. Consequently, it is necessary to check the diagnostic of the returned comparison before using it.
- Throws:
ComparisonCanceledException
- If the comparison is cancelled at any time.
-
builder
Creates a new builder to configure the creation of a new EMFCompare object.- Returns:
- a new builder.
-
DefaultComparisonScope
... it will be removed in a subsequent release.