org.eclipse.emf.compare.match.eobject

## Class EditionDistance

- java.lang.Object
- - org.eclipse.emf.compare.match.eobject.EditionDistance

All Implemented Interfaces:
  ProximityEObjectMatcher.DistanceFunction

    public class EditionDistance
    extends Object
    implements ProximityEObjectMatcher.DistanceFunction

This distance function implementation will actually compare the given EObject.

### Nested Class Summary

Nested Classes
`static class` `EditionDistance.Builder` Builder class to configure an EditionDistance instance.

### Constructor Summary

Constructors
Constructor and Description
`EditionDistance()` Instantiate a new Edition Distance that will use `WeightProviderDescriptorRegistryImpl.createStandaloneInstance()`.
`EditionDistance(WeightProvider.Descriptor.Registry registry)` Instantiate a new Edition Distance.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `areIdentic(Comparison inProgress, EObject a, EObject b)` Check that two objects are equals from the distance function point of view (distance should be 0) You should prefer this method when you just want to check objects are not equals enabling the distance to stop sooner.
`static EditionDistance.Builder` `builder()` Create a new builder to instantiate and configure an EditionDistance.
`double` `distance(Comparison inProgress, EObject a, EObject b)` Return the distance between two EObjects.
`double` `getThresholdAmount(EObject eObj)`
`protected double` `getThresholdRatio(int nbFeatures)` return a ratio to apply on the amount of maximum un-similarity amount depending on the number of features which are considered.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### EditionDistance

    public EditionDistance()

Instantiate a new Edition Distance that will use `WeightProviderDescriptorRegistryImpl.createStandaloneInstance()`.

#### EditionDistance

    public EditionDistance(WeightProvider.Descriptor.Registry registry)

Instantiate a new Edition Distance.

Parameters:
  `registry` - The registry of weight providers to use in this Edition Distance.

### Method Detail

#### distance

    public double distance(Comparison inProgress,
                           EObject a,
                           EObject b)

Return the distance between two EObjects. When the two objects should considered as completely different the implementation is expected to return Double.MAX_VALUE.

Specified by:
  `distance` in interface `ProximityEObjectMatcher.DistanceFunction`
Parameters:
  `inProgress` - the comparison being processed right now. This might be used for the distance to retrieve other matches for instance.
  `a` - first object.
  `b` - second object.
Returns:
  the distance between the two EObjects or Double.MAX_VALUE when the objects are considered too different to be the same.

#### areIdentic

    public boolean areIdentic(Comparison inProgress,
                              EObject a,
                              EObject b)

Check that two objects are equals from the distance function point of view (distance should be 0) You should prefer this method when you just want to check objects are not equals enabling the distance to stop sooner.

Specified by:
  `areIdentic` in interface `ProximityEObjectMatcher.DistanceFunction`
Parameters:
  `inProgress` - the comparison being processed right now. This might be used for the distance to retrieve other matches for instance.
  `a` - first object.
  `b` - second object.
Returns:
  true of the two objects are equals, false otherwise.

#### builder

    public static EditionDistance.Builder builder()

Create a new builder to instantiate and configure an EditionDistance.

Returns:
  a configuration builder.

#### getThresholdAmount

    public double getThresholdAmount(EObject eObj)

#### getThresholdRatio

    protected double getThresholdRatio(int nbFeatures)

return a ratio to apply on the amount of maximum un-similarity amount depending on the number of features which are considered.

Parameters:
  `nbFeatures` - the nb of features which should be considerd to compute the amount.
Returns:
  a ratio to appli on the amount of maximum un-similarity amount depending on the number of features which are considered.