Class UnconditionedExactTest.XYList
- java.lang.Object
-
- org.apache.commons.statistics.inference.UnconditionedExactTest.XYList
-
- Enclosing class:
- UnconditionedExactTest
private static class UnconditionedExactTest.XYList extends java.lang.ObjectAn expandable list of (x,y) values. This allows tracking 2D positions stored as a single index.
-
-
Constructor Summary
Constructors Constructor Description XYList(int maxx, int maxy)Create an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(int x, int y)Adds the value to the list.(package private) intget(int index)Gets the 2D index at the specifiedindex.(package private) intgetMaxX()Gets the maximum X value (inclusive).(package private) intgetMaxY()Gets the maximum Y value (inclusive).(package private) intgetWidth()Gets the width.(package private) booleanisEmpty()Checks if the list size is zero.(package private) booleanisFull()Checks if the list is the maximum capacity.(package private) intsize()Gets the number of elements in the list.
-
-
-
Method Detail
-
getWidth
int getWidth()
Gets the width. (x, y) values are stored using y * width + x.- Returns:
- the width
-
getMaxX
int getMaxX()
Gets the maximum X value (inclusive).- Returns:
- the max X
-
getMaxY
int getMaxY()
Gets the maximum Y value (inclusive).- Returns:
- the max Y
-
add
void add(int x, int y)Adds the value to the list.- Parameters:
x- X value.y- Y value.
-
get
int get(int index)
Gets the 2D index at the specifiedindex. The index is y * width + x:x = index % width y = index / width
- Parameters:
index- Element index.- Returns:
- the 2D index
-
size
int size()
Gets the number of elements in the list.- Returns:
- the size
-
isEmpty
boolean isEmpty()
Checks if the list size is zero.- Returns:
- true if empty
-
isFull
boolean isFull()
Checks if the list is the maximum capacity.- Returns:
- true if full
-
-