Class DefaultMatchEngine

    • 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 an IEObjectMatcher.
        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 an IEObjectMatcher.
        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 interface IMatchEngine
        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 of left, right and origin.
        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 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 cancellation
      • match

        protected void match​(Comparison comparison,
                             IComparisonScope scope,
                             ResourceSet left,
                             ResourceSet right,
                             ResourceSet origin,
                             Monitor monitor)
        This will be used to match the given ResourceSets. This default implementation will query the comparison scope for these resource sets children, then delegate to an IResourceMatcher 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 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 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 an IEObjectMatcher 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 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 cancellation
      • match

        protected void match​(Comparison comparison,
                             IComparisonScope scope,
                             EObject left,
                             EObject right,
                             EObject origin,
                             Monitor monitor)
        This will query the scope for the given EObjects' children, then delegate to an IEObjectMatcher to compute the Matches.

        We expect at least the left and right EObjects 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 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.
      • 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.
      • createDefaultEObjectMatcher

        public static IEObjectMatcher createDefaultEObjectMatcher​(UseIdentifiers useIDs)
        Creates and configures an IEObjectMatcher with the strategy given by useIDs. The cache 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 an IEObjectMatcher with the strategy given by useIDs. The cache 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 an IEObjectMatcher with the strategy given by useIDs. The cache 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.