public interface TwoDimensionalAccess<T> extends TwoDimensionalReadAccess<T>, MultiDimensionalAccess<T>
TwoDimensionalReadAccess.Base<TT>
Modifier and Type | Field and Description |
---|---|
static TwoDimensionalAccess<java.lang.Object> |
EMPTY
Empty 2dim array.
|
Modifier and Type | Method and Description |
---|---|
default void |
changeAll(java.util.function.BiFunction<? super T,int[],? extends T> operator)
Change all elements in this multi-dimensional array.
|
default void |
changeAll(java.util.function.Function<? super T,? extends T> operator)
Change all elements in this multi-dimensional array.
|
static <E> TwoDimensionalAccess<E> |
createConstant(E constant,
int sizeX,
int sizeY)
Create a 2dimensional array with the given sizes
with elements initialized to a given constant.
|
static <E> TwoDimensionalAccess<E> |
createIndexed(java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,? extends E> supplier,
int sizeX,
int sizeY)
Create a 2dimensional array with the given sizes
with elements initialized by their indices.
|
static <E> TwoDimensionalAccess<E> |
createNulled(int sizeX,
int sizeY)
Create a 2dimensional array with the given sizes
with elements initialized to null.
|
static <E> TwoDimensionalAccess<E> |
createSupplied(java.util.function.Supplier<? extends E> supplier,
int sizeX,
int sizeY)
Create a 2dimensional array with the given sizes
with elements initialized by a supplier.
|
static <E> TwoDimensionalAccess<E> |
empty()
Get an empty 2dimensional access.
|
default void |
fillByIndex(IntFunction2<? extends T> setter)
Set all values depending on their indexes.
|
default void |
setElement(T value,
int... indexes)
Set the element located at the given indexes.
|
void |
setElementAt(T element,
int ix,
int iy)
Set the element at the given indexes.
|
default OneDimensionalAccess<T> |
subAtX(int ix)
Get a 1-dimensional view of the row at the given X index.
|
default OneDimensionalAccess<T> |
subAtY(int iy)
Get a 1-dimensional view of the column at the given X index.
|
default TwoDimensionalAccess<T> |
transposed()
Get a transposed view of this 2-dimensional read access.
|
static <E> TwoDimensionalAccess<E> |
zeroX(int numY)
Get e 2dimensional access with zero elements in X direction.
|
static <E> TwoDimensionalAccess<E> |
zeroY(int numX)
Get e 2dimensional access with zero elements in Y direction.
|
asBase, equal, getElement, getElementAt, getNumDimensions, getNumElements, getSize, getSizes, hash, singleton, sizeX, sizeY, toString, view, visitAll, visitAll, xIterable, xIterator, yIterable, yIterator
change, setAll, setFrom, setFrom, setFrom
empty, linearized
static final TwoDimensionalAccess<java.lang.Object> EMPTY
empty()
instead.void setElementAt(T element, int ix, int iy)
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)default void setElement(T value, int... indexes)
MultiDimensionalAccess
setElement
in interface MultiDimensionalAccess<T>
value
- value to set at the location defined by the given indexesindexes
- MultiDimensional.getNumDimensions()
indexes inside the bounds
defined by MultiDimensional.getSizes()
@NotNull default OneDimensionalAccess<T> subAtX(int ix)
subAtX
in interface TwoDimensionalReadAccess<T>
ix
- X indexix
@NotNull default OneDimensionalAccess<T> subAtY(int iy)
subAtY
in interface TwoDimensionalReadAccess<T>
iy
- Y indexiy
@NotNull default TwoDimensionalAccess<T> transposed()
TwoDimensionalReadAccess
transposed
in interface TwoDimensionalReadAccess<T>
default void changeAll(@NotNull java.util.function.BiFunction<? super T,int[],? extends T> operator)
MultiDimensionalAccess
changeAll
in interface MultiDimensionalAccess<T>
operator
- operator to change the value, with the current value as first
argument and the indexes as second, returns the new valuedefault void changeAll(@NotNull java.util.function.Function<? super T,? extends T> operator)
MultiDimensionalAccess
changeAll
in interface MultiDimensionalAccess<T>
operator
- operator to change the value, with the current value as argumentdefault void fillByIndex(@NotNull IntFunction2<? extends T> setter)
setter
- setter which provides the value to set for each index combination@NotNull static <E> TwoDimensionalAccess<E> empty()
empty
in interface TwoDimensionalReadAccess<T>
E
- element type@NotNull static <E> TwoDimensionalAccess<E> zeroX(int numY)
E
- element typenumY
- number of elements in Y direction@NotNull static <E> TwoDimensionalAccess<E> zeroY(int numX)
E
- element typenumX
- number of elements in X direction@NotNull static <E> TwoDimensionalAccess<E> createNulled(int sizeX, int sizeY)
E
- element typesizeX
- size in X directionsizeY
- size in Y direction@NotNull static <E> TwoDimensionalAccess<E> createConstant(@Nullable E constant, int sizeX, int sizeY)
E
- element typeconstant
- constant to which all elements will be initializedsizeX
- size in X directionsizeY
- size in Y direction@NotNull static <E> TwoDimensionalAccess<E> createSupplied(@NotNull java.util.function.Supplier<? extends E> supplier, int sizeX, int sizeY)
E
- element typesupplier
- supplier for the initial elementssizeX
- size in X directionsizeY
- size in Y direction@NotNull static <E> TwoDimensionalAccess<E> createIndexed(@NotNull java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,? extends E> supplier, int sizeX, int sizeY)
E
- element typesupplier
- supplier for the initial elements, gets both X and Y index as argumentssizeX
- size in X directionsizeY
- size in Y direction