marf.util.comparators
Class FrequencyComparator
java.lang.Object
marf.util.SortComparator
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 |
private static long |
serialVersionUID
For serialization versioning. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
serialVersionUID
private static final long serialVersionUID
- For serialization versioning.
When adding new members or make other structural
changes regenerate this number with the
serialver
tool that comes with JDK.
- Since:
- 0.3.0.4
- See Also:
- Constant Field Values
FrequencyComparator
public FrequencyComparator(int piSortMode)
- Constructs a frequency comparator with the specified sort mode.
- Parameters:
piSortMode
- ASCENDING or DESCENDING
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 comparepoStatsObject2
- 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