Class NaturalRanking.IntList
- java.lang.Object
-
- org.apache.commons.statistics.ranking.NaturalRanking.IntList
-
- Enclosing class:
- NaturalRanking
private static class NaturalRanking.IntList extends java.lang.ObjectAn expandable list of int values. This allows tracking array positions without using boxed values in aList<Integer>.
-
-
Constructor Summary
Constructors Constructor Description IntList(int max)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(int value)Adds the value to the list.(package private) voidclear()Clear the list.(package private) intget(int index)Gets the element at the specifiedindex.(package private) voidshuffle(java.util.function.IntUnaryOperator randomIntFunction)Shuffle the list.(package private) intsize()Gets the number of elements in the list.private static voidswap(int[] array, int i, int j)Swaps the two specified elements in the specified array.
-
-
-
Method Detail
-
add
void add(int value)
Adds the value to the list.- Parameters:
value- the value
-
get
int get(int index)
Gets the element at the specifiedindex.- Parameters:
index- Element index- Returns:
- the element
-
size
int size()
Gets the number of elements in the list.- Returns:
- the size
-
clear
void clear()
Clear the list.
-
shuffle
void shuffle(java.util.function.IntUnaryOperator randomIntFunction)
Shuffle the list.- Parameters:
randomIntFunction- Function maps positivexrandomly to[0, x).
-
swap
private static void swap(int[] array, int i, int j)Swaps the two specified elements in the specified array.- Parameters:
array- Data arrayi- First indexj- Second index
-
-