- java.lang.Object
-
- eu.ess.xaos.ui.plot.util.AbscissaDataComparator<X>
-
- Type Parameters:
X
- The type of
- All Implemented Interfaces:
Comparator<XYChart.Data<X,?>>
public class AbscissaDataComparator<X> extends Object implements Comparator<XYChart.Data<X,?>>
Comparator to be used when searching forXYChart.Data
points within aXYChart.Series
.The comparison is performed against the X value (abscissa).- Author:
- claudio.rosati@esss.se
-
-
Constructor Summary
Constructors Constructor Description AbscissaDataComparator(Axis<X> xAxis)
Creates a new instance ofAbscissaDataComparator
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(XYChart.Data<X,?> data1, XYChart.Data<X,?> data2)
static <X> XYChart.Data<X,?>
key(X xValue)
Creates a new instance ofXYChart.Data
whoseXYChart.Data.getXValue()
will return the given X value.-
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
-
AbscissaDataComparator
public AbscissaDataComparator(Axis<X> xAxis)
Creates a new instance ofAbscissaDataComparator
.- Parameters:
xAxis
- Mandatory X axis associated with chart for whichXYChart.Data
should be compared.
-
-
Method Detail
-
key
public static <X> XYChart.Data<X,?> key(X xValue)
Creates a new instance ofXYChart.Data
whoseXYChart.Data.getXValue()
will return the given X value. Meant to be used to create search keys when using methods likeCollections.binarySearch(java.util.List, java.lang.Object, java.util.Comparator)
.- Type Parameters:
X
- The type of the X part of the returnedXYChart.Data
.- Parameters:
xValue
- X value of the returnedXYChart.Data
.- Returns:
- Data containing the given X value.
-
compare
public int compare(XYChart.Data<X,?> data1, XYChart.Data<X,?> data2)
- Specified by:
compare
in interfaceComparator<X>
-
-