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

  Class to run over a slice of a dataset

- - ### 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)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int[] sshape, int isize)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int[] start, int[] sshape)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int[] start, int[] sshape, int isize)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape, int isize)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, int isize, SliceND slice)` Constructor for an iterator over the elements of a sliced dataset
    `SliceIterator(int[] shape, int length, SliceND slice)` Constructor for an iterator over the elements of a sliced dataset

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getPos()`
    `int[]` | `getShape()`
    `int[]` | `getStart()`
    `int[]` | `getStep()`
    `boolean` | `hasNext()`
    `void` | `reset()` Reset iterator
    `void` | `setStart(int... newStart)` Set start (prefix with zeros if necessary)

    - ### 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)

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `sshape` - shape of new dataset, i.e. slice

    - #### SliceIterator

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

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `start` - (if null then equivalent to the origin)
        `sshape` - shape of new dataset, i.e. slice

    - #### SliceIterator

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

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `sshape` - shape of 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)

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `start` - (if null then equivalent to the origin)
        `sshape` - shape of 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)

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `start` - (if null then equivalent to the origin)
        `step` - (cannot contain zeros, if null then equivalent to ones)
        `sshape` - shape of new dataset, i.e. slice

    - #### SliceIterator

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

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `slice` -

    - #### SliceIterator

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

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `isize` - number of elements in an item
        `slice` -

    - #### SliceIterator

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

      Constructor for an iterator over the elements of a sliced dataset
      Parameters:
        `shape` - or dataShape
        `length` - of entire data array
        `start` - (if null then equivalent to the origin)
        `step` - (cannot contain zeros, if null then equivalent to ones)
        `sshape` - shape of new dataset, i.e. slice
        `isize` - number of elements in an item

  - ### Method Detail

    - #### setStart

          public void setStart(int... newStart)

      Set start (prefix with zeros if necessary)
      Parameters:
        `newStart` - if null, then treat as origin

    - #### reset

          public void reset()

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

    - #### hasNext

          public boolean hasNext()

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

    - #### getStart

          public int[] getStart()

    - #### 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)

    - #### getStep

          public int[] getStep()

    - #### getShape

          public int[] getShape()

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

Copyright © 2017. All rights reserved.