Package adams.data.container
Class DataPointComparator<T extends DataPoint>
- java.lang.Object
-
- adams.data.container.DataPointComparator<T>
-
- All Implemented Interfaces:
Serializable
,Comparator<T>
- Direct Known Subclasses:
InstancePointComparator
,SpreadSheetRowPointComparator
,TimeseriesPointComparator
,XYSequencePointComparator
public abstract class DataPointComparator<T extends DataPoint> extends Object implements Comparator<T>, Serializable
A comparator for sequence points.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Ascending
whether the ordering is ascending or descending.
-
Constructor Summary
Constructors Constructor Description DataPointComparator()
The default constructor uses comparison in ascending manner.DataPointComparator(boolean ascending)
This constructor initializes the comparator either in ascending manner or descending.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
compare(T o1, T o2)
Compares its two arguments for order.boolean
isAscending()
Returns whether the ordering is done in ascending or descending manner.-
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
DataPointComparator
public DataPointComparator()
The default constructor uses comparison in ascending manner.
-
DataPointComparator
public DataPointComparator(boolean ascending)
This constructor initializes the comparator either in ascending manner or descending.- Parameters:
ascending
- if true then the ordering is done in ascending manner, otherwise descending
-
-
Method Detail
-
isAscending
public boolean isAscending()
Returns whether the ordering is done in ascending or descending manner.- Returns:
- true if ordering it in ascending manner
-
compare
public abstract int compare(T o1, T o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Specified by:
compare
in interfaceComparator<T extends DataPoint>
- Parameters:
o1
- the first objecto2
- the second object- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
-