Package org.eclipse.emf.compare
Class EMFCompare
- java.lang.Object
-
- org.eclipse.emf.compare.EMFCompare
-
public class EMFCompare extends Object
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 throughEMFCompare.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
andright
) while ignoring their identifiers, with a given progress monitor (call itprogress
), you can do so through :EMFCompare.builder().setMatchEngine(DefaultMatchEngine.create(UseIdentifiers.NEVER)).build().compare(EMFCompare.createDefaultScope(left, right), new BasicMonitor())
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EMFCompare.Builder
A Builder pattern to instantiate EMFCompare objects.
-
Field Summary
Fields Modifier and Type Field Description static String
DIAGNOSTIC_SOURCE
The value for diagnostics coming from EMF compare.
-
Constructor Summary
Constructors Modifier Constructor Description 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static EMFCompare.Builder
builder()
Creates a new builder to configure the creation of a new EMFCompare object.Comparison
compare(IComparisonScope scope)
Computes and returns a new Comparison object representation the differences between Notifier in the givescope
.Comparison
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.this was only a delegation to the publicly accessibleDefaultComparisonScope
... it will be removed in a subsequent release.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 Detail
-
DIAGNOSTIC_SOURCE
public static final String DIAGNOSTIC_SOURCE
The value for diagnostics coming from EMF compare.- Since:
- 3.2
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
createDefaultScope
@Deprecated public static IComparisonScope createDefaultScope(Notifier left, Notifier right)
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:
DefaultComparisonScope
-
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:
DefaultComparisonScope
-
compare
public Comparison compare(IComparisonScope scope)
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
public Comparison compare(IComparisonScope scope, Monitor monitor)
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
public static EMFCompare.Builder builder()
Creates a new builder to configure the creation of a new EMFCompare object.- Returns:
- a new builder.
-
-