org.finetracker
Class HypothesisComparator

java.lang.Object
  extended by org.finetracker.HypothesisComparator
All Implemented Interfaces:
java.util.Comparator<Hypothesis>

public class HypothesisComparator
extends java.lang.Object
implements java.util.Comparator<Hypothesis>

Compares two Hypothesis objects on the basis of score and path taken in the lexicon.

Author:
Frank Kusters

Constructor Summary
HypothesisComparator()
           
 
Method Summary
 int compare(Hypothesis h1, Hypothesis h2)
          Compares two Hypothesis objects on the basis of score and path taken in the lexicon.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

HypothesisComparator

public HypothesisComparator()
Method Detail

compare

public int compare(Hypothesis h1,
                   Hypothesis h2)
Compares two Hypothesis objects on the basis of score and path taken in the lexicon. It is considered 'better' if, in order of importance:

Specified by:
compare in interface java.util.Comparator<Hypothesis>
Parameters:
h1 - the first hypothesis
h2 - the second hypothesis
Returns:
-1 if h1 is 'better' than h2, 0 if they are equal, and 1 if h2 is 'better' than h1.
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)