Class URIDistance
java.lang.Object
org.eclipse.emf.compare.match.eobject.URIDistance
- All Implemented Interfaces:
com.google.common.base.Function<EObject,
,Iterable<String>> Function<EObject,
Iterable<String>>
public class URIDistance
extends Object
implements com.google.common.base.Function<EObject,Iterable<String>>
This class is able to measure similarity between "URI like" strings, basically strings separated by "/".
This is mainly intended to be used with EMF's fragments.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
return the maximum value we can get for this distance.int
Return a metric result URI similarities.int
Return a metric result URI similarities.retrieveFragment
(EObject input) the containing fragment for a givenEObject
.void
setComparison
(Comparison comparison) Set an optional comparison used to retrieve matches already computed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.common.base.Function
equals
-
Constructor Details
-
URIDistance
public URIDistance()Create a newURIDistance
.
-
-
Method Details
-
setComparison
Set an optional comparison used to retrieve matches already computed. This will impact the way the uri is computed by making sure two matching objects will have the same URI.- Parameters:
comparison
- the comparison to use to retrieve the matches.
-
proximity
Return a metric result URI similarities. It compares 2 strings splitting those by "/" and return an int representing the level of similarity. 0 - they are exactly the same to 10 - they are completely different. "adding a fragment", "removing a fragment". -
proximity
Return a metric result URI similarities. It compares 2 lists of fragments and return an int representing the level of similarity. 0 - they are exactly the same to 10 - they are completely different. "adding a fragment", "removing a fragment". -
apply
-
retrieveFragment
the containing fragment for a givenEObject
.- Parameters:
input
- an EObject.- Returns:
- a String representation of its containing fragment.
-
getUpperBoundDistance
public int getUpperBoundDistance()return the maximum value we can get for this distance.- Returns:
- the maximum value we can get for this distance.
-