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 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()) .

  • Field Details

    • DIAGNOSTIC_SOURCE

      public static final String 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 comparison
      diffEngine - IDiffEngine to use to compute comparison
      reqEngine - IReqEngine to use to compute comparison
      equiEngine - IEquiEngine to use to compute comparison
      conflictDetector - IConflictDetector to use to compute comparison
      postProcessorFactoryRegistry - PostProcessorRegistry to use to find an IPostProcessor
  • Method Details

    • createDefaultScope

      @Deprecated public static IComparisonScope createDefaultScope(Notifier left, Notifier right)
      Deprecated.
      this was only a delegation to the publicly accessible DefaultComparisonScope... 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 accessible DefaultComparisonScope... 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 of left and right.
      Returns:
      The newly created scope, as used as default by EMF Compare.
      See Also:
    • compare

      public Comparison compare(IComparisonScope scope)
      Computes and returns a new Comparison object representation the differences between Notifier in the give scope.
      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 given monitor.
      Parameters:
      scope - the scope to compare, must not be null.
      monitor - the monitor to report progress to, must not be null. done() will be called on it. If the monitor is cancelled, the result may be null (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.