de.caff.generics.mda

## Class SmallTwoDimensionalBitArray

- java.lang.Object
- - de.caff.generics.mda.TwoDimensionalReadAccess.Base<java.lang.Boolean>
  - - de.caff.generics.mda.TwoDimensionalBooleanReadAccess.Base
    - - de.caff.generics.mda.SmallTwoDimensionalBitArray

- All Implemented Interfaces:
    MultiDimensional, MultiDimensionalAccess<java.lang.Boolean>, MultiDimensionalReadAccess<java.lang.Boolean>, TwoDimensionalAccess<java.lang.Boolean>, TwoDimensionalBooleanAccess, TwoDimensionalBooleanReadAccess, TwoDimensionalReadAccess<java.lang.Boolean>

      public class SmallTwoDimensionalBitArray
      extends TwoDimensionalBooleanReadAccess.Base
      implements TwoDimensionalBooleanAccess

  Two-dimensional array of boolean values optimized for small sizes.

  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.

  Since:
    November 11, 2019
  Author:
    Rammi

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface de.caff.generics.mda.TwoDimensionalBooleanReadAccess

      `TwoDimensionalBooleanReadAccess.Base`

  - ### Field Summary

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

      `EMPTY`

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

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

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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

    - ### Methods inherited from class de.caff.generics.mda.TwoDimensionalBooleanReadAccess.Base

      `asBase`

    - ### Methods inherited from class de.caff.generics.mda.TwoDimensionalReadAccess.Base

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

      `changeAllValues, changeValueAt, fillValuesByIndex, setElementAt, subAtX, subAtY, transposed`

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

      `asBase, getElementAt, singleton`

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

      `changeAll, changeAll, createConstant, createIndexed, createNulled, createSupplied, empty, fillByIndex, setElement, zeroX, zeroY`

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

      `equal, getElement, getNumDimensions, getNumElements, getSize, getSizes, hash, toString, view, visitAll, visitAll, xIterable, xIterator, yIterable, yIterator`

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

      `change, setAll, setFrom, setFrom, setFrom`

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

      `empty, linearized`

- - ### Constructor Detail

    - #### SmallTwoDimensionalBitArray

          public SmallTwoDimensionalBitArray(int xSize,
                                             int ySize)

      Constructor. This fills all elements with `0.0` values.
      Parameters:
        `xSize` - X size of array
        `ySize` - Y size of array
      Throws:
        `java.lang.IllegalArgumentException` - on negative sizes or if linearized size becoms too large
      See Also:
        `SmallTwoDimensionalBitArray(int, int, IntPredicate2)`

    - #### SmallTwoDimensionalBitArray

          public SmallTwoDimensionalBitArray(int xSize,
                                             int ySize,
                                             @NotNull
                                             IntPredicate2 filler)

      Initializing constructor.
      Parameters:
        `xSize` - X size of array
        `ySize` - Y size of array
        `filler` - setter function which provides the value to set for each index combination
      Throws:
        `java.lang.IllegalArgumentException` - on negative sizes or if linearized size becoms too large
      See Also:
        `TwoDimensionalBooleanAccess.fillValuesByIndex(IntPredicate2)`

    - #### SmallTwoDimensionalBitArray

          public SmallTwoDimensionalBitArray(int ySize,
                                             boolean... values)

      Constructor.
      Parameters:
        `ySize` - size in y direction
        `values` - 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.

    - #### SmallTwoDimensionalBitArray

          public SmallTwoDimensionalBitArray(@NotNull
                                             TwoDimensionalBooleanReadAccess array)

      Copy constructor.
      Parameters:
        `array` - array to copy
      Throws:
        `java.lang.IllegalArgumentException` - on negative sizes or if linearized size becoms too large

  - ### Method Detail

    - #### setValueAt

          public void setValueAt(boolean value,
                                 int ix,
                                 int iy)

      Set the value at the given indexes.
      Specified by:
        `setValueAt` in interface `TwoDimensionalBooleanAccess`
      Parameters:
        `value` - value to set
        `ix` - X index
        `iy` - Y index

    - #### getValueAt

          public boolean getValueAt(int ix,
                                    int iy)

      Get the value at the given indexes.
      Specified by:
        `getValueAt` in interface `TwoDimensionalBooleanReadAccess`
      Parameters:
        `ix` - X index
        `iy` - Y index
      Returns:
        value at given index

    - #### sizeX

          public int sizeX()

      Description copied from interface: `TwoDimensionalReadAccess`
      Get the number of elements in X direction.
      Specified by:
        `sizeX` in interface `TwoDimensionalReadAccess<java.lang.Boolean>`
      Returns:
        number of elements in X direction

    - #### sizeY

          public int sizeY()

      Description copied from interface: `TwoDimensionalReadAccess`
      Get the number of elements in Y direction
      Specified by:
        `sizeY` in interface `TwoDimensionalReadAccess<java.lang.Boolean>`
      Returns:
        number of elements in Y direction

    - #### copy

          @NotNull
          public SmallTwoDimensionalBitArray copy()

      Get a copy of this array.
      Returns:
        copy of this array