marf.util.comparators
Class ResultComparator

java.lang.Object
  |
  +--marf.util.SortComparator
        |
        +--marf.util.comparators.ResultComparator
All Implemented Interfaces:
java.util.Comparator, java.io.Serializable

public class ResultComparator
extends SortComparator

Compares two Result objects for equality.

Used in sorting. $Id: ResultComparator.java,v 1.10 2005/06/01 19:38:51 mokhov Exp $

Since:
0.3.0
Version:
$Revision: 1.10 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class marf.util.SortComparator
ASCENDING, DESCENDING, iSortMode
 
Constructor Summary
ResultComparator(int piMethod)
          Takes the sorting mode into consideration.
 
Method Summary
 int compare(java.lang.Object poResult1, java.lang.Object poResult2)
          Implementation of the Comparator interface for the Result objects.
static java.lang.String getRevision()
          Returns source code revision information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ResultComparator

public ResultComparator(int piMethod)
Takes the sorting mode into consideration.

Parameters:
piMethod - sorting method, either ASCENDING or DESCENDING
Method Detail

compare

public int compare(java.lang.Object poResult1,
                   java.lang.Object poResult2)
Implementation of the Comparator interface for the Result objects. To decide on inequality of the Results objects we compare their outcome (distance or probability) value only. Takes into consideration ASCENDING or DESCENDING order of sorting.

Parameters:
poResult1 - first Result object for comparison
poResult2 - second Result object for comparison
Returns:
0 if the objects are equal, 1 if the 2nd is greater then the 1st under ASCENDING, or the 1st is greater then the 2nd under DESCENDING. Otherwise, -2 is returned.

getRevision

public static java.lang.String getRevision()
Returns source code revision information.

Returns:
revision string