Class NaturalRanking.DataPosition
- java.lang.Object
-
- org.apache.commons.statistics.ranking.NaturalRanking.DataPosition
-
- All Implemented Interfaces:
java.lang.Comparable<NaturalRanking.DataPosition>
- Enclosing class:
- NaturalRanking
private static class NaturalRanking.DataPosition extends java.lang.Object implements java.lang.Comparable<NaturalRanking.DataPosition>
Represents the position of adouble
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.
-
-
Constructor Summary
Constructors Constructor Description DataPosition(double value, int position)
Create an instance with the given value and position.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(NaturalRanking.DataPosition other)
Compare this value to another.(package private) int
getPosition()
Returns the data position.
-
-
-
Method Detail
-
compareTo
public int compareTo(NaturalRanking.DataPosition other)
Compare this value to another. Only the values are compared.- Specified by:
compareTo
in interfacejava.lang.Comparable<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
-
-