use of org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher in project tdq-studio-se by Talend.
the class ModelElementMatchEngine method createDQEObjectMatcher.
/**
* Creates and configures an {@link IEObjectMatcher} with the strategy given by {@code useIDs}. The {@code cache}
* will be used to cache some expensive computation (should better a LoadingCache).
*
* @param useIDs which strategy the return IEObjectMatcher must follow.
* @param weightProviderRegistry the match engine needs a WeightProvider in case of this match engine do not use
* identifiers.
* @return a new IEObjectMatcher.
*/
public static IEObjectMatcher createDQEObjectMatcher(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry) {
final IEObjectMatcher matcher;
final ModelElementEditonDistance editionDistance = new ModelElementEditonDistance(weightProviderRegistry);
final CachingDistance cachedDistance = new CachingDistance(editionDistance);
switch(useIDs) {
case NEVER:
matcher = new ProximityEObjectMatcher(cachedDistance);
break;
case ONLY:
matcher = new IdentifierEObjectMatcher();
break;
case WHEN_AVAILABLE:
// fall through to default
default:
// Use an ID matcher, delegating to proximity when no ID is available
final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(cachedDistance);
matcher = new IdentifierEObjectMatcher(contentMatcher);
break;
}
return matcher;
}
Aggregations