Interface ProximityEObjectMatcher.DistanceFunction

  • All Known Implementing Classes:
    CachingDistance, EditionDistance
    Enclosing class:
    ProximityEObjectMatcher

    public static interface ProximityEObjectMatcher.DistanceFunction
    This represent a distance function used by the ProximityEObjectMatcher to compare EObjects and retrieve the closest EObject from one side to another. Axioms of the distance are supposed to be respected more especially :
    • symetry : dist(a,b) == dist(b,a)
    • separation :dist(a,a) == 0
    Triangular inequality is not leveraged with the current implementation but might be at some point to speed up the indexing.
    computing the distance between two EObjects should be a fast operation or the scalability of the whole matching phase will be poor.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      double distance​(Comparison inProgress, EObject a, EObject b)
      Return the distance between two EObjects.
    • Method Detail

      • distance

        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.
        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

        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.
        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.