Package adams.flow.sink.sequenceplotter
Class SequencePlotPointComparator<X extends Number & Comparable,Y extends Number & Comparable>
- java.lang.Object
-
- adams.data.container.DataPointComparator
-
- adams.data.sequence.XYSequencePointComparator<X,Y>
-
- adams.flow.sink.sequenceplotter.SequencePlotPointComparator<X,Y>
-
- Type Parameters:
X
- the type of XY
- the type of Y
- All Implemented Interfaces:
Serializable
,Comparator
public class SequencePlotPointComparator<X extends Number & Comparable,Y extends Number & Comparable> extends XYSequencePointComparator<X,Y>
A comparator for XY sequence points.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.data.sequence.XYSequencePointComparator
XYSequencePointComparator.Comparison
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_MetaDataKey
the meta-data value to take into account for the sorting.-
Fields inherited from class adams.data.sequence.XYSequencePointComparator
m_Comparison
-
Fields inherited from class adams.data.container.DataPointComparator
m_Ascending
-
-
Constructor Summary
Constructors Constructor Description SequencePlotPointComparator()
The default constructor uses comparison by XandY in ascending manner and not meta-data key.SequencePlotPointComparator(XYSequencePointComparator.Comparison comp, boolean ascending, String metaDataKey)
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 int
compare(DataPoint o1, DataPoint o2)
Compares its two arguments for order.protected Object
getMetaData(SequencePlotPoint p)
Returns the associated meta-data value.String
getMetaDataKey()
Returns the meta-data key to use for the comparison.-
Methods inherited from class adams.data.sequence.XYSequencePointComparator
getComparison
-
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_MetaDataKey
protected String m_MetaDataKey
the meta-data value to take into account for the sorting.
-
-
Constructor Detail
-
SequencePlotPointComparator
public SequencePlotPointComparator()
The default constructor uses comparison by XandY in ascending manner and not meta-data key.
-
SequencePlotPointComparator
public SequencePlotPointComparator(XYSequencePointComparator.Comparison comp, boolean ascending, String metaDataKey)
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
-
getMetaDataKey
public String getMetaDataKey()
Returns the meta-data key to use for the comparison.- Returns:
- the key, null if not used
-
getMetaData
protected Object getMetaData(SequencePlotPoint p)
Returns the associated meta-data value.- Parameters:
p
- the point to obtain the meta-data from- Returns:
- the value, null if not available
-
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.- Overrides:
compare
in classXYSequencePointComparator<X extends Number & Comparable,Y extends Number & Comparable>
- 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.
-
-