org.eclipse.january.dataset

## Class SliceNDIterator

- java.lang.Object
- - org.eclipse.january.dataset.IndexIterator
  - - org.eclipse.january.dataset.SliceNDIterator

-     public class SliceNDIterator
      extends IndexIterator

  Class to provide slice iteration through a dataset

  It allows a number of axes to be omitted and iterates over the axes left over. The omitted axes define an inner shape and the remaining axes define an outer shape which is iterated over.

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.january.dataset.IndexIterator

      `index`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SliceNDIterator(SliceND slice, int... axes)` Constructor for an iterator that misses out several axes

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `SliceND` | `getCurrentSlice()` Get current slice
    `boolean[]` | `getOmit()`
    `SliceND` | `getOmittedSlice()` Get omitted part of source slice which never changes.
    `SliceND` | `getOutputSlice()` Get output or destination slice
    `int[]` | `getPos()`
    `int[]` | `getShape()`
    `int[]` | `getUsedPos()` Shortened position where axes are omitted
    `SliceND` | `getUsedSlice()` Shortened slice where axes are omitted
    `boolean` | `hasNext()`
    `void` | `reset()` Reset iterator

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

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

- - ### Constructor Detail

    - #### SliceNDIterator

          public SliceNDIterator(SliceND slice,
                         int... axes)

      Constructor for an iterator that misses out several axes
      Parameters:
        `slice` -
        `axes` - missing axes

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in class `IndexIterator`
      Returns:
        true if there is another iteration

    - #### getPos

          public int[] getPos()

      Specified by:
        `getPos` in class `IndexIterator`
      Returns:
        position indices (nb this is reference not a copy so avoid changing and can be null)

    - #### getOmittedSlice

          public SliceND getOmittedSlice()

      Get omitted part of source slice which never changes. I.e. the inner slice
      Returns:
        slice (can be null)

    - #### getOutputSlice

          public SliceND getOutputSlice()

      Get output or destination slice
      Returns:
        slice

    - #### getCurrentSlice

          public SliceND getCurrentSlice()

      Get current slice
      Returns:
        slice

    - #### getUsedPos

          public int[] getUsedPos()

      Shortened position where axes are omitted
      Returns:
        used position

    - #### getUsedSlice

          public SliceND getUsedSlice()

      Shortened slice where axes are omitted
      Returns:
        used (or outer) slice

    - #### getOmit

          public boolean[] getOmit()

      Returns:
        omit array - array where true means miss out

    - #### reset

          public void reset()

      Description copied from class: `IndexIterator`
      Reset iterator
      Specified by:
        `reset` in class `IndexIterator`

    - #### getShape

          public int[] getShape()

      Overrides:
        `getShape` in class `IndexIterator`
      Returns:
        shape of iterator (can be null, if not known or applicable)

Copyright © 2014–2019 Eclipse Foundation. All rights reserved.