public interface MultiDimensionalAccess<T> extends MultiDimensionalReadAccess<T>
Modifier and Type | Method and Description |
---|---|
default T |
change(java.util.function.Function<? super T,? extends T> operator,
int... indexes)
Change the value located at the given indexes.
|
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.
|
default MultiDimensionalAccess<T> |
setAll(java.util.function.Function<int[],? extends T> provider)
Set all elements.
|
void |
setElement(T value,
int... indexes)
Set the element located at the given indexes.
|
default void |
setFrom(MultiIndexLinearizer.Sequencer sequencer,
java.util.Collection<? extends T> elements)
Set all elements in this multi-dimensional access from the given collection.
|
default void |
setFrom(MultiIndexLinearizer.Sequencer sequencer,
Indexable<? extends T> elements)
Set all elements in this multi-dimensional access from the given indexable collection.
|
default void |
setFrom(MultiIndexLinearizer.Sequencer sequencer,
java.lang.Iterable<? extends T> elements)
Set all elements in this multi-dimensional access from the given iterable.
|
empty, getElement, linearized, visitAll, visitAll
getNumDimensions, getNumElements, getSize, getSizes
void setElement(T value, int... indexes)
value
- value to set at the location defined by the given indexesindexes
- MultiDimensional.getNumDimensions()
indexes inside the bounds
defined by MultiDimensional.getSizes()
default T change(@NotNull java.util.function.Function<? super T,? extends T> operator, int... indexes)
This default implementation is only slightly more efficient than
a get
and set
sequence,
but implementing classes are encouraged to provide better implementations
(e.g. the index linearization has only to happen once).
operator
- operator to apply to the value at the location defined by the given indexes.
When used on a specialized primitive type array the operator
will never receive null
, and must not return null
.
In other cases this depends on usage.indexes
- MultiDimensional.getNumDimensions()
indexes inside the bounds
defined by MultiDimensional.getSizes()
default void changeAll(@NotNull java.util.function.BiFunction<? super T,int[],? extends T> operator)
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)
operator
- operator to change the value, with the current value as argumentdefault void setFrom(@NotNull MultiIndexLinearizer.Sequencer sequencer, @NotNull java.util.Collection<? extends T> elements)
sequencer
- sequencer defining the order in which the elements are setelements
- collection with at least MultiDimensional.getNumElements()
elementsjava.lang.IllegalArgumentException
- if there are not enough elements in the collection.
This access is not changed in this case.default void setFrom(@NotNull MultiIndexLinearizer.Sequencer sequencer, @NotNull Indexable<? extends T> elements)
sequencer
- sequencer defining the order in which the elements are setelements
- indexable collection with at least MultiDimensional.getNumElements()
elementsjava.lang.IllegalArgumentException
- if there are not enough elements in the indexable collection.
This access is not changed in this case.default void setFrom(@NotNull MultiIndexLinearizer.Sequencer sequencer, @NotNull java.lang.Iterable<? extends T> elements)
sequencer
- sequencerelements
- iteration with at least MultiDimensional.getNumElements()
elementsjava.lang.IllegalArgumentException
- if there are not enough elements in the collection.
This access is probably already changed in this case.default MultiDimensionalAccess<T> setAll(@NotNull java.util.function.Function<int[],? extends T> provider)
provider
- provider called for each elementthis
for chaining