de.caff.generics.mda

## Interface MultiDimensionalAccess<T>

- All Superinterfaces:
    MultiDimensional, MultiDimensionalReadAccess<T>
  All Known Subinterfaces:
    OneDimensionalAccess<T>, OneDimensionalBooleanAccess, OneDimensionalByteAccess, OneDimensionalCharAccess, OneDimensionalDoubleAccess, OneDimensionalFloatAccess, OneDimensionalIntAccess, OneDimensionalLongAccess, OneDimensionalShortAccess, ThreeDimensionalAccess<T>, ThreeDimensionalBooleanAccess, ThreeDimensionalByteAccess, ThreeDimensionalCharAccess, ThreeDimensionalDoubleAccess, ThreeDimensionalFloatAccess, ThreeDimensionalIntAccess, ThreeDimensionalLongAccess, ThreeDimensionalShortAccess, TwoDimensionalAccess<T>, TwoDimensionalBooleanAccess, TwoDimensionalByteAccess, TwoDimensionalCharAccess, TwoDimensionalDoubleAccess, TwoDimensionalFloatAccess, TwoDimensionalIntAccess, TwoDimensionalLongAccess, TwoDimensionalShortAccess
  All Known Implementing Classes:
    AbstractBasicMultiDimensionalArray, MultiDimensionalArray, MultiDimensionalBooleanArray, MultiDimensionalByteArray, MultiDimensionalCharArray, MultiDimensionalDoubleArray, MultiDimensionalFloatArray, MultiDimensionalIntArray, MultiDimensionalLongArray, MultiDimensionalShortArray, OneDimensionalArray, OneDimensionalBooleanArray, OneDimensionalByteArray, OneDimensionalCharArray, OneDimensionalDoubleArray, OneDimensionalFloatArray, OneDimensionalIntArray, OneDimensionalLongArray, OneDimensionalShortArray, SmallTwoDimensionalArray, SmallTwoDimensionalBitArray, SmallTwoDimensionalBooleanArray, SmallTwoDimensionalByteArray, SmallTwoDimensionalCharArray, SmallTwoDimensionalDoubleArray, SmallTwoDimensionalFloatArray, SmallTwoDimensionalIntArray, SmallTwoDimensionalLongArray, SmallTwoDimensionalShortArray, ThreeDimensionalArray, ThreeDimensionalBooleanArray, ThreeDimensionalByteArray, ThreeDimensionalCharArray, ThreeDimensionalDoubleArray, ThreeDimensionalFloatArray, ThreeDimensionalIntArray, ThreeDimensionalLongArray, ThreeDimensionalShortArray, TwoDimensionalArray, TwoDimensionalBooleanArray, TwoDimensionalByteArray, TwoDimensionalCharArray, TwoDimensionalDoubleArray, TwoDimensionalFloatArray, TwoDimensionalIntArray, TwoDimensionalLongArray, TwoDimensionalShortArray

      public interface MultiDimensionalAccess<T>
      extends MultiDimensionalReadAccess<T>

  Multi-dimensional read-write access.
  Since:
    November 02, 2019
  Author:
    Rammi

- - ### Field Summary

    - ### Fields inherited from interface de.caff.generics.mda.MultiDimensionalReadAccess

      `EMPTY0, EMPTY1, EMPTY2, EMPTY3, EMPTY4, EMPTY5, EMPTY6, EMPTY7`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    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.

    - ### Methods inherited from interface de.caff.generics.mda.MultiDimensionalReadAccess

      `empty, getElement, linearized, visitAll, visitAll`

    - ### Methods inherited from interface de.caff.generics.mda.MultiDimensional

      `getNumDimensions, getNumElements, getSize, getSizes`

- - ### Method Detail

    - #### setElement

          void setElement(T value,
                          int... indexes)

      Set the element located at the given indexes.
      Parameters:
        `value` - value to set at the location defined by the given indexes
        `indexes` - `MultiDimensional.getNumDimensions()` indexes inside the bounds defined by `MultiDimensional.getSizes()`

    - #### change

          default T change(@NotNull
                           java.util.function.Function<? super T,? extends T> operator,
                           int... indexes)

      Change the value located at the given 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).

      Parameters:
        `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()`
      Returns:
        changed value

    - #### changeAll

          default void changeAll(@NotNull
                                 java.util.function.BiFunction<? super T,int[],? extends T> operator)

      Change all elements in this multi-dimensional array. This will run over all elements and call the operator on each.
      Parameters:
        `operator` - operator to change the value, with the current value as first argument and the indexes as second, returns the new value

    - #### changeAll

          default void changeAll(@NotNull
                                 java.util.function.Function<? super T,? extends T> operator)

      Change all elements in this multi-dimensional array. This will run over all elements and call the operator on each.
      Parameters:
        `operator` - operator to change the value, with the current value as argument

    - #### setFrom

          default void setFrom(@NotNull
                               MultiIndexLinearizer.Sequencer sequencer,
                               @NotNull
                               java.util.Collection<? extends T> elements)

      Set all elements in this multi-dimensional access from the given collection.
      Parameters:
        `sequencer` - sequencer defining the order in which the elements are set
        `elements` - collection with at least `MultiDimensional.getNumElements()` elements
      Throws:
        `java.lang.IllegalArgumentException` - if there are not enough elements in the collection. This access is not changed in this case.

    - #### setFrom

          default void setFrom(@NotNull
                               MultiIndexLinearizer.Sequencer sequencer,
                               @NotNull
                               Indexable<? extends T> elements)

      Set all elements in this multi-dimensional access from the given indexable collection.
      Parameters:
        `sequencer` - sequencer defining the order in which the elements are set
        `elements` - indexable collection with at least `MultiDimensional.getNumElements()` elements
      Throws:
        `java.lang.IllegalArgumentException` - if there are not enough elements in the indexable collection. This access is not changed in this case.

    - #### setFrom

          default void setFrom(@NotNull
                               MultiIndexLinearizer.Sequencer sequencer,
                               @NotNull
                               java.lang.Iterable<? extends T> elements)

      Set all elements in this multi-dimensional access from the given iterable.
      Parameters:
        `sequencer` - sequencer
        `elements` - iteration with at least `MultiDimensional.getNumElements()` elements
      Throws:
        `java.lang.IllegalArgumentException` - if there are not enough elements in the collection. This access is probably already changed in this case.

    - #### setAll

          default MultiDimensionalAccess<T> setAll(@NotNull
                                                   java.util.function.Function<int[],? extends T> provider)

      Set all elements.
      Parameters:
        `provider` - provider called for each element
      Returns:
        `this` for chaining