de.caff.generics.mda

## Class PartlyFixedMultiIndexLinearizer

- java.lang.Object
- - de.caff.generics.mda.PartlyFixedMultiIndexLinearizer

- All Implemented Interfaces:
    MultiDimensional, MultiIndexLinearizer

      class PartlyFixedMultiIndexLinearizer
      extends java.lang.Object
      implements MultiIndexLinearizer

  A multi-index linearizer which keeps some indexes fix and only allows to set the remaining ones.

  Not public because automatically created when accessing sub arrays and therefore not fit for base arrays.

  Since:
    November 01, 2019
  Author:
    Rammi

- - ### Nested Class Summary

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

      `MultiIndexLinearizer.BasicSequencer, MultiIndexLinearizer.Sequencer`

  - ### Field Summary

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

      `OPEN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PartlyFixedMultiIndexLinearizer(MultiIndexLinearizer basicLinearizer, int... fixedIndexes)` Create a lower-dimensional linearizer by providing some fixed indexes.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getNumDimensions()` Get the number of dimensions used by this access,
    `long` | `getNumElements()` Get the combined number of elements in all dimensions.
    `int` | `getSize(int dim)` Get the size of the given dimension.
    `int[]` | `getSizes()` Get the sizes of the dimensions of this access.
    `int` | `toLinear(int... indexes)` Get the linear index which represents the given multi-dimensional index.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

      `checkIndex, checkIndexes, getHighFastSequencer, getLowFastSequencer, sub`

- - ### Constructor Detail

    - #### PartlyFixedMultiIndexLinearizer

          PartlyFixedMultiIndexLinearizer(@NotNull
                                          MultiIndexLinearizer basicLinearizer,
                                          @NotNull
                                          int... fixedIndexes)

      Create a lower-dimensional linearizer by providing some fixed indexes.
      Parameters:
        `basicLinearizer` - basic linearizer with n dimensions
        `fixedIndexes` - indexes of sub array, negative for open indexes which can still be evalutated by the returned linearizer, or `0` or positive for fixed indexes. If there are not enough indexes the missing ones are considered open.

  - ### Method Detail

    - #### getNumDimensions

          public int getNumDimensions()

      Description copied from interface: `MultiDimensional`
      Get the number of dimensions used by this access,
      Specified by:
        `getNumDimensions` in interface `MultiDimensional`
      Returns:
        number of dimensions

    - #### getSize

          public int getSize(int dim)

      Description copied from interface: `MultiDimensional`
      Get the size of the given dimension.
      Specified by:
        `getSize` in interface `MultiDimensional`
      Parameters:
        `dim` - dimension, greater than `0` and less than `MultiDimensional.getNumDimensions()`
      Returns:
        number of elements in the given dimension

    - #### getSizes

          @NotNull
          public int[] getSizes()

      Description copied from interface: `MultiDimensional`
      Get the sizes of the dimensions of this access.
      Specified by:
        `getSizes` in interface `MultiDimensional`
      Returns:
        array of length `MultiDimensional.getNumDimensions()`

    - #### toLinear

          public int toLinear(@NotNull
                              int... indexes)

      Description copied from interface: `MultiIndexLinearizer`
      Get the linear index which represents the given multi-dimensional index. Please note that the returned values may fall outside of the range defined by `MultiDimensional.getNumElements()` when this linearizer only represents a part of a larger-dimensional multi-index.

      Good practice is to check the incoming index whether they fulfill their bounds. Use `MultiIndexLinearizer.checkIndexes(int[], int...)` for this.

      Specified by:
        `toLinear` in interface `MultiIndexLinearizer`
      Parameters:
        `indexes` - `MultiDimensional.getNumDimensions()` indexes inside the ranges defined by `MultiDimensional.getSizes()`
      Returns:
        linearized index

    - #### getNumElements

          public long getNumElements()

      Description copied from interface: `MultiDimensional`
      Get the combined number of elements in all dimensions.
      Specified by:
        `getNumElements` in interface `MultiDimensional`
      Returns:
        number of all elements in this multi-dimensional array