public class SmallTwoDimensionalBitArray extends TwoDimensionalBooleanReadAccess.Base implements TwoDimensionalBooleanAccess
This internally maps to a one-dimensional long array which is created faster.
Because of the mapping the size of the dimensions is restricted in a way that the
number of elements in this array (i.e. the product of its X and Y size) is less
than 64 times Integer.MAX_VALUE
.
Use TwoDimensionalBooleanArray
if you are not sure to always obey this restriction.
Compared to SmallTwoDimensionalBooleanArray
this allows 64 times elements,
but has slower access times.
TwoDimensionalBooleanReadAccess.Base
EMPTY
Constructor and Description |
---|
SmallTwoDimensionalBitArray(int ySize,
boolean... values)
Constructor.
|
SmallTwoDimensionalBitArray(int xSize,
int ySize)
Constructor.
|
SmallTwoDimensionalBitArray(int xSize,
int ySize,
IntPredicate2 filler)
Initializing constructor.
|
SmallTwoDimensionalBitArray(TwoDimensionalBooleanReadAccess array)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
SmallTwoDimensionalBitArray |
copy()
Get a copy of this array.
|
boolean |
getValueAt(int ix,
int iy)
Get the value at the given indexes.
|
void |
setValueAt(boolean value,
int ix,
int iy)
Set the value at the given indexes.
|
int |
sizeX()
Get the number of elements in X direction.
|
int |
sizeY()
Get the number of elements in Y direction
|
asBase
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
changeAllValues, changeValueAt, fillValuesByIndex, setElementAt, subAtX, subAtY, transposed
asBase, getElementAt, singleton
changeAll, changeAll, createConstant, createIndexed, createNulled, createSupplied, empty, fillByIndex, setElement, zeroX, zeroY
equal, getElement, getNumDimensions, getNumElements, getSize, getSizes, hash, toString, view, visitAll, visitAll, xIterable, xIterator, yIterable, yIterator
change, setAll, setFrom, setFrom, setFrom
empty, linearized
public SmallTwoDimensionalBitArray(int xSize, int ySize)
0.0
values.xSize
- X size of arrayySize
- Y size of arrayjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largeSmallTwoDimensionalBitArray(int, int, IntPredicate2)
public SmallTwoDimensionalBitArray(int xSize, int ySize, @NotNull IntPredicate2 filler)
xSize
- X size of arrayySize
- Y size of arrayfiller
- setter function which provides the value to set for each index combinationjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largeTwoDimensionalBooleanAccess.fillValuesByIndex(IntPredicate2)
public SmallTwoDimensionalBitArray(int ySize, boolean... values)
ySize
- size in y directionvalues
- values in order, the first ySize
values
will become row 0, the second ySize
values
row 1, and so on. Needs a multiple of ySize values.public SmallTwoDimensionalBitArray(@NotNull TwoDimensionalBooleanReadAccess array)
array
- array to copyjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largepublic void setValueAt(boolean value, int ix, int iy)
setValueAt
in interface TwoDimensionalBooleanAccess
value
- value to setix
- X indexiy
- Y indexpublic boolean getValueAt(int ix, int iy)
getValueAt
in interface TwoDimensionalBooleanReadAccess
ix
- X indexiy
- Y indexpublic int sizeX()
TwoDimensionalReadAccess
sizeX
in interface TwoDimensionalReadAccess<java.lang.Boolean>
public int sizeY()
TwoDimensionalReadAccess
sizeY
in interface TwoDimensionalReadAccess<java.lang.Boolean>
@NotNull public SmallTwoDimensionalBitArray copy()