T - element type of this arraypublic class SmallTwoDimensionalArray<T> extends TwoDimensionalReadAccess.Base<T> implements TwoDimensionalAccess<T>
This internally maps to a one-dimensional 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 or equal toInteger.MAX_VALUE. Use TwoDimensionalArray if you are not
sure to always obey this restriction.
TwoDimensionalReadAccess.Base<TT>EMPTY| Constructor and Description |
|---|
SmallTwoDimensionalArray(int xSize,
int ySize)
Constructor.
|
SmallTwoDimensionalArray(int xSize,
int ySize,
IntFunction2<T> filler)
Initializing constructor.
|
SmallTwoDimensionalArray(int ySize,
T... values)
Constructor.
|
SmallTwoDimensionalArray(TwoDimensionalReadAccess<? extends T> array)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
SmallTwoDimensionalArray<T> |
copy()
Get a copy of this array.
|
T |
getElementAt(int ix,
int iy)
Get the element at the given indexes.
|
void |
invertX()
Invert the row order in X direction.
|
void |
invertY()
Invert the row order in Y direction.
|
void |
setElementAt(T element,
int ix,
int iy)
Set the element 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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitchangeAll, changeAll, createConstant, createIndexed, createNulled, createSupplied, empty, fillByIndex, setElement, subAtX, subAtY, transposed, zeroX, zeroYasBase, equal, getElement, getNumDimensions, getNumElements, getSize, getSizes, hash, singleton, toString, view, visitAll, visitAll, xIterable, xIterator, yIterable, yIteratorchange, setAll, setFrom, setFrom, setFromempty, linearizedpublic SmallTwoDimensionalArray(int xSize,
int ySize)
0.0 values.xSize - X size of arrayySize - Y size of arraySmallTwoDimensionalArray(int, int, IntFunction2)public SmallTwoDimensionalArray(int xSize,
int ySize,
@NotNull
IntFunction2<T> filler)
xSize - X size of arrayySize - Y size of arrayfiller - setter function which provides the value to set for each index combinationTwoDimensionalAccess.fillByIndex(IntFunction2)@SafeVarargs
public SmallTwoDimensionalArray(int ySize,
T... 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 SmallTwoDimensionalArray(@NotNull TwoDimensionalReadAccess<? extends T> array)
array - array to copypublic void invertX()
public void invertY()
public void setElementAt(T element, int ix, int iy)
TwoDimensionalAccesssetElementAt in interface TwoDimensionalAccess<T>element - element to setix - index in X direction from 0 (included) to TwoDimensionalReadAccess.sizeX() (excluded)iy - index in Y direction from 0 (included) to TwoDimensionalReadAccess.sizeY() (excluded)public T getElementAt(int ix, int iy)
TwoDimensionalReadAccessgetElementAt in interface TwoDimensionalReadAccess<T>ix - index in X direction from 0 (included) to TwoDimensionalReadAccess.sizeX() (excluded)iy - index in Y direction from 0 (included) to TwoDimensionalReadAccess.sizeY() (excluded)public int sizeX()
TwoDimensionalReadAccesssizeX in interface TwoDimensionalReadAccess<T>public int sizeY()
TwoDimensionalReadAccesssizeY in interface TwoDimensionalReadAccess<T>@NotNull public SmallTwoDimensionalArray<T> copy()