Class MetaHitsFirstComparator

  • All Implemented Interfaces:
    java.util.Comparator<Hit>

    public class MetaHitsFirstComparator
    extends ChainableComparator
    Ensures that meta hits are sorted before normal hits. All meta hits are considered equal.
    Author:
    Tony Vaagenes
    • Constructor Summary

      Constructors 
      Constructor Description
      MetaHitsFirstComparator​(java.util.Comparator<Hit> secondaryComparator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Hit left, Hit right)
      Returns the comparison form the secondary comparison, or 0 if the secondary is null.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • MetaHitsFirstComparator

        public MetaHitsFirstComparator​(java.util.Comparator<Hit> secondaryComparator)
    • Method Detail

      • compare

        public int compare​(Hit left,
                           Hit right)
        Description copied from class: ChainableComparator
        Returns the comparison form the secondary comparison, or 0 if the secondary is null. When overriding this in the subclass, always return super.compare(first,second) at the end of the subclass' implementation.
        Specified by:
        compare in interface java.util.Comparator<Hit>
        Overrides:
        compare in class ChainableComparator
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object