Class Relevance

  • All Implemented Interfaces:
    java.lang.Comparable<Relevance>

    public class Relevance
    extends java.lang.Object
    implements java.lang.Comparable<Relevance>
    A relevance double value. These values should ideally be normalized between 0 and 1 (where 1 means "perfect"), however this is not enforced.

    Sources may create subclasses of this to include additional information or functionality.

    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      Relevance​(double score)
      Construct a relevancy object with an initial value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Relevance other)
      Compares relevancy values with
      boolean equals​(java.lang.Object other)
      Compares relevancy values
      double getScore()
      Returns the relevancy score of this, preferably a normalized value between 0 and 1 but this is not guaranteed by this framework
      int hashCode()
      Returns a hash from the relevancy value
      void setScore​(double score)
      Set score value to this value.
      java.lang.String toString()
      Returns the score value as a string
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Relevance

        public Relevance​(double score)
        Construct a relevancy object with an initial value. This initial value should ideally be a normalized value between 0 and 1, but that is not enforced.
        Parameters:
        score - the initial value (rank score)
    • Method Detail

      • setScore

        public void setScore​(double score)
        Set score value to this value. This should ideally be a normalized value between 0 and 1, but that is not enforced. NaN is also a legal value, for elements where it makes no sense to assign a particular value.
      • getScore

        public double getScore()
        Returns the relevancy score of this, preferably a normalized value between 0 and 1 but this is not guaranteed by this framework
      • toString

        public java.lang.String toString()
        Returns the score value as a string
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(Relevance other)
        Compares relevancy values with
        Specified by:
        compareTo in interface java.lang.Comparable<Relevance>
      • equals

        public boolean equals​(java.lang.Object other)
        Compares relevancy values
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns a hash from the relevancy value
        Overrides:
        hashCode in class java.lang.Object