de.fu_berlin.ties.classify
Class PredictionComparator

java.lang.Object
  extended byde.fu_berlin.ties.classify.PredictionComparator
All Implemented Interfaces:
Comparator

public class PredictionComparator
extends Object
implements Comparator

A comparison function that compares Predictions based on their pRs and probabilities.

Version:
$Revision: 1.3 $, $Date: 2004/04/02 14:34:42 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
PredictionComparator()
          Creates a new instance.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares two Predictions.
 String toString()
          Returns a string representation of this object.
 
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
 

Constructor Detail

PredictionComparator

public PredictionComparator()
Creates a new instance.

Method Detail

compare

public int compare(Object o1,
                   Object o2)
            throws ClassCastException
Compares two Predictions. This method checks whether the pR values of both predictions are given and compares them if they are. Otherwise the probabilities are compared. In case of a tie the raw scores are compared if both are WinnowPredictions. Otherwise the types are compared lexicographically.

Specified by:
compare in interface Comparator
Parameters:
o1 - the first prediction to be compared
o2 - the second prediction to be compared
Returns:
a negative integer, zero, or a positive integer if the first argument is less than, equal to, or greater than of the second
Throws:
ClassCastException - if either of the arguments is not a Prediction

toString

public String toString()
Returns a string representation of this object.

Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.