Class RootIDMatchingStrategy
java.lang.Object
org.eclipse.emf.compare.match.resource.RootIDMatchingStrategy
- All Implemented Interfaces:
IResourceMatchingStrategy
This implementation of a matching strategy checks for the IDs of the resources' roots, and consider that
resources match if the identifiers of their roots do.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected MatchResource
createMatchResource
(Resource left, Resource right, Resource origin) Creates aMatchResource
instance and sets all three resources of the mapping on it.protected Resource
Deprecated.findMatches
(Resource reference, Iterable<Resource> candidates) Returns the first two matches ofreference
incandidates
.getResourceIdentifiers
(Resource resource) Retrieves the set of identifiers for the given resource's root.matchResources
(Iterable<? extends Resource> left, Iterable<? extends Resource> right, Iterable<? extends Resource> origin) Matches the given resources according to the IDs found in their roots.
-
Constructor Details
-
RootIDMatchingStrategy
public RootIDMatchingStrategy()
-
-
Method Details
-
matchResources
public List<MatchResource> matchResources(Iterable<? extends Resource> left, Iterable<? extends Resource> right, Iterable<? extends Resource> origin) Matches the given resources according to the IDs found in their roots.When the root IDs of two resources intersect, they are considered as matching. This strategy will only return unique matches between all 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 unique mappings this strategy managed to determine.
-
findMatches
Returns the first two matches ofreference
incandidates
. This implementation will consider two Resources to be "matches" if their roots have IDs, and these IDs intersect.Subclasses may return more than two elements if considered useful.
- Parameters:
reference
- The reference resource.candidates
- The list of potential candidates that may matchreference
.- Returns:
- The first two matches of
reference
incandidates
. Empty list if none. - Since:
- 3.3
-
findMatch
Deprecated.usefindMatches(Resource, Iterable)
instead.Returns the first match ofreference
incandidates
. This implementation will consider two Resources to be "matches" if their roots have IDs, and these IDs are the same.- Parameters:
reference
- The reference resource.candidates
- The list of potential candidates that may matchreference
.- Returns:
- The first match of
reference
incandidates
.null
if none.
-
getResourceIdentifiers
Retrieves the set of identifiers for the given resource's root.- Parameters:
resource
- The resource for which we need the identifiers.- Returns:
- The identifiers (both XMI:ID and eAttribute ID) of the resource's roots, if any. May be empty if the resource has no roots or if they have no ID.
-
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.
-
findMatches(Resource, Iterable)
instead.