marf.util.comparators
Class FrequencyComparator

java.lang.Object
  extended by marf.util.SortComparator
      extended by marf.util.comparators.FrequencyComparator
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator

public class FrequencyComparator
extends SortComparator

Compares StatisticalObjects by their frequency when sorting.

$Id: FrequencyComparator.java,v 1.15 2007/12/01 00:26:51 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.15 $
Author:
Serguei Mokhov
See Also:
StatisticalObject, WordStats, Serialized Form

Field Summary
 
Fields inherited from class marf.util.SortComparator
ASCENDING, DESCENDING, iSortMode
 
Constructor Summary
FrequencyComparator(int piSortMode)
          Constructs a frequency comparator with the specified sort mode.
 
Method Summary
 int compare(java.lang.Object poStatsObject1, java.lang.Object poStatsObject2)
          Implementation of the Comparator interface for the StatisticalObjects.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 
Methods inherited from class marf.util.SortComparator
getSortMode
 
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

FrequencyComparator

public FrequencyComparator(int piSortMode)
Constructs a frequency comparator with the specified sort mode.

Parameters:
piSortMode - ASCENDING or DESCENDING
Method Detail

compare

public int compare(java.lang.Object poStatsObject1,
                   java.lang.Object poStatsObject2)
Implementation of the Comparator interface for the StatisticalObjects. To decide on inequality of the StatisticalObject objects we compare their frequencies only.

Parameters:
poStatsObject1 - first stats object to compare
poStatsObject2 - second stats object to compare
Returns:
0 of the frequencies are equal. Depending on the sort mode; a negative value may mean poStatsObject1 < poStatsObject2 if ASCENDING; or otherwise if DESCENDING
See Also:
Comparator.compare(java.lang.Object, java.lang.Object), StatisticalObject

getMARFSourceCodeRevision

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

Returns:
revision string


SourceForge Logo