Class UnconditionedExactTest.XYList
- java.lang.Object
-
- org.apache.commons.statistics.inference.UnconditionedExactTest.XYList
-
- Enclosing class:
- UnconditionedExactTest
private static class UnconditionedExactTest.XYList extends java.lang.Object
An 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) void
add(int x, int y)
Adds the value to the list.(package private) int
get(int index)
Gets the 2D index at the specifiedindex
.(package private) int
getMaxX()
Gets the maximum X value (inclusive).(package private) int
getMaxY()
Gets the maximum Y value (inclusive).(package private) int
getWidth()
Gets the width.(package private) boolean
isEmpty()
Checks if the list size is zero.(package private) boolean
isFull()
Checks if the list is the maximum capacity.(package private) int
size()
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
-
-