Class LocationMatchingStrategy
java.lang.Object
org.eclipse.emf.compare.match.resource.LocationMatchingStrategy
- All Implemented Interfaces:
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected static MatchResource
createMatchResource
(Resource left, Resource right, Resource origin) Creates aMatchResource
instance and sets all three resources of the mapping on it.protected Resource
Returns the first match ofreference
incandidates
.matchResources
(Iterable<? extends Resource> left, Iterable<? extends Resource> right, Iterable<? extends Resource> origin) This will be called by the resource matcher in order to determine the matching between n resources.
-
Constructor Details
-
LocationMatchingStrategy
public LocationMatchingStrategy()
-
-
Method Details
-
matchResources
public List<MatchResource> matchResources(Iterable<? extends Resource> left, Iterable<? extends Resource> right, 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 interfaceIResourceMatchingStrategy
- 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:
-
findMatch
Returns the first match ofreference
incandidates
. 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 matchreference
.- Returns:
- The first match of
reference
incandidates
.null
if none.
-
createMatchResource
Creates aMatchResource
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.
-