org.eclipse.january.dataset

## Class SliceIterator

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

- Direct Known Subclasses:
    NullIterator, StrideIterator

      public class SliceIterator
      extends IndexIterator

  The `SliceIterator` class is use to run over a Slice of a Dataset. This is an Iterator thats allows the programmer to traverse the elements of a sliced Dataset and obtain the current position, the starts, steps, shapes. Moreover, there is possibilities to set the start point to begin at the wanted position.

- - ### Field Summary

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

      `index`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SliceIterator(int[] shape, int length, int[] sshape)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int[] sshape, int isize)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int[] start, int[] sshape)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int[] start, int[] sshape, int isize)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape, int isize)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, int isize, SliceND slice)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
    `SliceIterator(int[] shape, int length, SliceND slice)` Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getPos()` Returns the current position of the iterator.
    `int[]` | `getShape()` Returns an array of the Slices shapes.
    `int[]` | `getStart()` Returns an array of starts indexes.
    `int[]` | `getStep()` Returns an array of steps
    `boolean` | `hasNext()` Returns `true` if there is an other element after the current Slice.
    `void` | `reset()` Reset the Iterator to the first Slice.
    `void` | `setStart(int... newStart)` Set the starts indexes to new positions, `if null` the start index is set by default to 0

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

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

- - ### Constructor Detail

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] sshape)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `sshape` - Shape of the new dataset, i.e. slice

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] start,
                       int[] sshape)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `start` - Array of starts indexes, may be `null`
        `sshape` - Shape of the new dataset, i.e. slice

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] sshape,
                       int isize)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `sshape` - Shape of the new dataset, i.e. slice
        `isize` - Number of elements in an item

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] start,
                       int[] sshape,
                       int isize)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `start` - Array of starts indexes, may be `null`
        `sshape` - Shape of the new dataset, i.e. slice
        `isize` - Number of elements in an item

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] start,
                       int[] step,
                       int[] sshape)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `start` - Array of starts indexes, may be `null`
        `step` - Array of steps, may be `null`, but can't be 0
        `sshape` - shape of new dataset, i.e. slice

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       SliceND slice)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `slice` - SliceND to iterate on

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int isize,
                       SliceND slice)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `isize` - Number of elements in an item
        `slice` - SliceND to iterate on

    - #### SliceIterator

          public SliceIterator(int[] shape,
                       int length,
                       int[] start,
                       int[] step,
                       int[] sshape,
                       int isize)

      Constructs an SliceIterator Object, which can iterate over sliced Datasets elements, by default the start set to 0 and with a step of 1.
      Parameters:
        `shape` - Array of shapes of the Dataset
        `length` - Length of entire data array
        `start` - Array of starts indexes, may be `null`
        `step` - Array of steps, may be `null`, but can't be 0
        `sshape` - Shape of the new dataset, i.e. slice
        `isize` - Number of elements in an item

  - ### Method Detail

    - #### setStart

          public void setStart(int... newStart)

      Set the starts indexes to new positions, `if null` the start index is set by default to 0
      Parameters:
        `newStart` - Array of new starts indexes (prefix with zeros if necessary), may be `null`

    - #### reset

          public void reset()

      Reset the Iterator to the first Slice.
      Specified by:
        `reset` in class `IndexIterator`

    - #### hasNext

          public boolean hasNext()

      Returns `true` if there is an other element after the current Slice.
      Specified by:
        `hasNext` in class `IndexIterator`
      Returns:
        Returns `true` if the iteration has more Slice, `false` in the other case

    - #### getStart

          public int[] getStart()

      Returns an array of starts indexes.
      Returns:
        Array of starts indexes

    - #### getPos

          public int[] getPos()

      Returns the current position of the iterator.
      Specified by:
        `getPos` in class `IndexIterator`
      Returns:
        Iterator current position

    - #### getStep

          public int[] getStep()

      Returns an array of steps
      Returns:
        Array of steps

    - #### getShape

          public int[] getShape()

      Returns an array of the Slices shapes.
      Overrides:
        `getShape` in class `IndexIterator`
      Returns:
        Array of shapes.

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