Class LocationMatchingStrategy

java.lang.Object
org.eclipse.emf.compare.match.resource.LocationMatchingStrategy
All Implemented Interfaces:
IResourceMatchingStrategy

public class LocationMatchingStrategy
extends java.lang.Object
implements IResourceMatchingStrategy
This implementation of a matching strategy will only use String equality on the resource URIs to try and find resource mappings. This is only applicable when comparing or merging models with version control systems like git, it makes no sense for local comparisons.
  • Constructor Summary

    Constructors 
    Constructor Description
    LocationMatchingStrategy()  
  • Method Summary

    Modifier and Type Method Description
    protected static MatchResource createMatchResource​(Resource left, Resource right, Resource origin)
    Creates a MatchResource instance and sets all three resources of the mapping on it.
    protected Resource findMatch​(Resource reference, java.lang.Iterable<Resource> candidates)
    Returns the first match of reference in candidates.
    java.util.List<MatchResource> matchResources​(java.lang.Iterable<? extends Resource> left, java.lang.Iterable<? extends Resource> right, java.lang.Iterable<? extends Resource> origin)
    This will be called by the resource matcher in order to determine the matching between n resources.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • matchResources

      public java.util.List<MatchResource> matchResources​(java.lang.Iterable<? extends Resource> left, java.lang.Iterable<? extends Resource> right, java.lang.Iterable<? extends Resource> origin)
      This will be called by the resource matcher in order to determine the matching between n resources.
      Specified by:
      matchResources in interface IResourceMatchingStrategy
      Parameters:
      left - Resources we are to match in the left.
      right - Resources we are to match in the right.
      origin - Resources we are to match in the origin.
      Returns:
      The list of mappings this strategy managed to determine.
      See Also:
      IResourceMatchingStrategy.matchResources(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)
    • findMatch

      protected Resource findMatch​(Resource reference, java.lang.Iterable<Resource> candidates)
      Returns the first match of reference in candidates. This implementation will consider two Resources to be "matches" if they have the same location.
      Parameters:
      reference - The reference resource.
      candidates - The list of potential candidates that may match reference.
      Returns:
      The first match of reference in candidates. null if none.
    • createMatchResource

      protected static MatchResource createMatchResource​(Resource left, Resource right, Resource origin)
      Creates a MatchResource instance and sets all three resources of the mapping on it.
      Parameters:
      left - The left resource of this mapping.
      right - The right resource of this mapping.
      origin - The origin resource of this mapping.
      Returns:
      The create mapping.