Package adams.data.sequence
Class XYSequencePointComparator<X extends Number & Comparable,Y extends Number & Comparable>
- java.lang.Object
-
- adams.data.container.DataPointComparator
-
- adams.data.sequence.XYSequencePointComparator<X,Y>
-
- Type Parameters:
X- the type of XY- the type of Y
- All Implemented Interfaces:
Serializable,Comparator
- Direct Known Subclasses:
SequencePlotPointComparator
public class XYSequencePointComparator<X extends Number & Comparable,Y extends Number & Comparable> extends DataPointComparator
A comparator for XY sequence points.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXYSequencePointComparator.ComparisonThe type of comparison to perform.
-
Field Summary
Fields Modifier and Type Field Description protected XYSequencePointComparator.Comparisonm_Comparisonhow to compare.-
Fields inherited from class adams.data.container.DataPointComparator
m_Ascending
-
-
Constructor Summary
Constructors Constructor Description XYSequencePointComparator()The default constructor uses comparison by X in ascending manner.XYSequencePointComparator(XYSequencePointComparator.Comparison comp, boolean ascending)This constructor initializes the comparator either with comparison by X or by Y or both.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(DataPoint o1, DataPoint o2)Compares its two arguments for order.XYSequencePointComparator.ComparisongetComparison()Returns the type of comparison.-
Methods inherited from class adams.data.container.DataPointComparator
isAscending
-
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
-
-
-
-
Field Detail
-
m_Comparison
protected XYSequencePointComparator.Comparison m_Comparison
how to compare.
-
-
Constructor Detail
-
XYSequencePointComparator
public XYSequencePointComparator()
The default constructor uses comparison by X in ascending manner.
-
XYSequencePointComparator
public XYSequencePointComparator(XYSequencePointComparator.Comparison comp, boolean ascending)
This constructor initializes the comparator either with comparison by X or by Y or both. Either in ascending manner or descending.- Parameters:
comp- the type of comparisonascending- if true then the ordering is done in ascending manner, otherwise descending
-
-
Method Detail
-
getComparison
public XYSequencePointComparator.Comparison getComparison()
Returns the type of comparison.- Returns:
- the comparison
-
compare
public int compare(DataPoint o1, DataPoint 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:
comparein classDataPointComparator- 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.
-
-