edu.stanford.nlp.util
Class ScoredComparator

java.lang.Object
  extended by edu.stanford.nlp.util.ScoredComparator
All Implemented Interfaces:
Serializable, Comparator

public final class ScoredComparator
extends Object
implements Comparator, Serializable

ScoredComparator allows one to compare Scored things. There are two ScoredComparators, one which sorts in ascending order and the other in descending order. They are implemented as singletons.

Author:
Dan Klein, Christopher Manning
See Also:
Serialized Form

Field Summary
static ScoredComparator ASCENDING_COMPARATOR
           
static ScoredComparator DESCENDING_COMPARATOR
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 boolean equals(Object o)
           
 int hashCode()
          Return the hashCode: there are only two distinct comparators by equals().
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ASCENDING_COMPARATOR

public static final ScoredComparator ASCENDING_COMPARATOR

DESCENDING_COMPARATOR

public static final ScoredComparator DESCENDING_COMPARATOR
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator

equals

public boolean equals(Object o)
Specified by:
equals in interface Comparator
Overrides:
equals in class Object

hashCode

public int hashCode()
Return the hashCode: there are only two distinct comparators by equals().

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Stanford NLP Group