Class NaturalRanking.DataPosition
java.lang.Object
org.apache.commons.statistics.ranking.NaturalRanking.DataPosition
- All Implemented Interfaces:
Comparable<NaturalRanking.DataPosition>
- Enclosing class:
NaturalRanking
private static class NaturalRanking.DataPosition
extends Object
implements Comparable<NaturalRanking.DataPosition>
Represents the position of a
double
value in a data array. The
Comparable interface is implemented so Arrays.sort can be used to sort an
array of data positions by value. Note that the implicitly defined natural
ordering is NOT consistent with equals.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataPosition
(double value, int position) Create an instance with the given value and position. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare this value to another.(package private) int
Returns the data position.
-
Field Details
-
value
private final double valueData value. -
position
private final int positionData position.
-
-
Constructor Details
-
DataPosition
DataPosition(double value, int position) Create an instance with the given value and position.- Parameters:
value
- Data value.position
- Data position.
-
-
Method Details
-
compareTo
Compare this value to another. Only the values are compared.- Specified by:
compareTo
in interfaceComparable<NaturalRanking.DataPosition>
- Parameters:
other
- the other pair to compare this to- Returns:
- result of
Double.compare(value, other.value)
-
getPosition
int getPosition()Returns the data position.- Returns:
- position
-