Class IdenticalResourceMinimizer

  • All Implemented Interfaces:
    IModelMinimizer

    public class IdenticalResourceMinimizer
    extends Object
    implements IModelMinimizer
    Instances of this class will be used by EMF Compare to minimize the scope to parts of a logical model that can be considered valid candidates for a difference.

    This default implementation will consider that all files that are binary identical between the two (or three) sides of the comparison can be safely removed from the scope. Likewise, unmatched read-only files will be removed from the scope.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean equals​(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right)
      Checks whether the two given (non-null) resources are identical.
      protected boolean equals​(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right, org.eclipse.core.resources.IStorage origin)
      Checks whether the three given (non-null) resources are identical.
      void minimize​(org.eclipse.core.resources.IFile file, SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)
      This will be called to reduce the number of resources in this model's traversals based on the given starting point of the left logical model.
      void minimize​(SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)
      This will be called to reduce the number of resources in this model's traversals.
      protected org.eclipse.core.resources.IStorage removeLikeNamedStorageFrom​(org.eclipse.core.resources.IStorage reference, Set<? extends org.eclipse.core.resources.IStorage> candidates)
      Looks up into the candidates set for a storage which name matches that of the reference storage, removing it if there is one.
    • Constructor Detail

      • IdenticalResourceMinimizer

        public IdenticalResourceMinimizer()
    • Method Detail

      • minimize

        public void minimize​(org.eclipse.core.resources.IFile file,
                             SynchronizationModel syncModel,
                             org.eclipse.core.runtime.IProgressMonitor monitor)
        This will be called to reduce the number of resources in this model's traversals based on the given starting point of the left logical model. Specifically, this minimizer does not consider the selected file and performs the same operation as it does without the file.
        Specified by:
        minimize in interface IModelMinimizer
        Parameters:
        file - The file that has been used as the starting point to resolve the left logical model.
        syncModel - The synchronization model to be minimized.
        monitor - Monitor on which to report progress to the user.
        See Also:
        IModelMinimizer.minimize(IFile, SynchronizationModel, IProgressMonitor)
      • equals

        protected boolean equals​(org.eclipse.core.resources.IStorage left,
                                 org.eclipse.core.resources.IStorage right,
                                 org.eclipse.core.resources.IStorage origin)
        Checks whether the three given (non-null) resources are identical. This default implementation only checks that the three are identical binary-wise.

        Identical resources will be filtered out of the comparison scope.

        Parameters:
        left - Left of the resources to consider.
        right - Right of the resources to consider.
        origin - Common ancestor of the left and right resources.
        Returns:
        true if the given resources are to be considered identical, false otherwise.
      • equals

        protected boolean equals​(org.eclipse.core.resources.IStorage left,
                                 org.eclipse.core.resources.IStorage right)
        Checks whether the two given (non-null) resources are identical. This default implementation only checks that the two are identical binary-wise.

        Identical resources will be filtered out of the comparison scope.

        Parameters:
        left - Left of the resources to consider.
        rightRight - of the resources to consider.
        Returns:
        true if the given resources are to be considered identical, false otherwise.
      • removeLikeNamedStorageFrom

        protected org.eclipse.core.resources.IStorage removeLikeNamedStorageFrom​(org.eclipse.core.resources.IStorage reference,
                                                                                 Set<? extends org.eclipse.core.resources.IStorage> candidates)
        Looks up into the candidates set for a storage which name matches that of the reference storage, removing it if there is one.
        Parameters:
        reference - The storage for which we'll seek a match into candidates.
        candidates - The set of candidates into which to look up for a match to reference.
        Returns:
        The first storage from the set of candidates that matches the reference, if any. null if none match.