Class DistanceEntry<E>

  • Type Parameters:
    E - the type of Entry used in the index
    All Implemented Interfaces:
    java.lang.Comparable<DistanceEntry<E>>

    public class DistanceEntry<E>
    extends java.lang.Object
    implements java.lang.Comparable<DistanceEntry<E>>
    Helper class: encapsulates an entry in an Index and a distance value belonging to this entry.
    Since:
    0.1
    Author:
    Elke Achtert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double distance
      The distance value belonging to the entry.
      private E entry
      The entry of the Index.
    • Constructor Summary

      Constructors 
      Constructor Description
      DistanceEntry​(E entry, double distance)
      Constructs a new DistanceEntry object with the specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(DistanceEntry<E> o)
      Compares this object with the specified object for order.
      double getDistance()
      Returns the distance value belonging to the entry.
      E getEntry()
      Returns the entry of the Index.
      java.lang.String toString()
      Returns a string representation of the object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • entry

        private E entry
        The entry of the Index.
      • distance

        private double distance
        The distance value belonging to the entry.
    • Constructor Detail

      • DistanceEntry

        public DistanceEntry​(E entry,
                             double distance)
        Constructs a new DistanceEntry object with the specified parameters.
        Parameters:
        entry - the entry of the Index
        distance - the distance value belonging to the entry
    • Method Detail

      • getEntry

        public E getEntry()
        Returns the entry of the Index.
        Returns:
        the entry of the Index
      • getDistance

        public double getDistance()
        Returns the distance value belonging to the entry.
        Returns:
        the distance value belonging to the entry
      • compareTo

        public int compareTo​(DistanceEntry<E> o)
        Compares this object with the specified object for order.
        Specified by:
        compareTo in interface java.lang.Comparable<E>
        Parameters:
        o - the Object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object.