org.eclipse.january.dataset

## Class ContiguousIteratorWithPosition

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

-     public class ContiguousIteratorWithPosition
      extends IndexIterator

  Class to run over contiguous datasets and keep track of position. Note this is slower than ContiguousIterator

- - ### Field Summary

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

      `index`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContiguousIteratorWithPosition(int[] shape, int length)` Constructor for an iterator over the items of a dataset that are within the dimensions
    `ContiguousIteratorWithPosition(int[] shape, int length, int isize)` Constructor for an iterator over the items of a dataset that are within the dimensions

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getPos()`
    `int[]` | `getShape()`
    `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

    - #### ContiguousIteratorWithPosition

          public ContiguousIteratorWithPosition(int[] shape,
                                                int length)

      Constructor for an iterator over the items of a dataset that are within the dimensions
      Parameters:
        `shape` - to use
        `length` - of entire data array

    - #### ContiguousIteratorWithPosition

          public ContiguousIteratorWithPosition(int[] shape,
                                                int length,
                                                int isize)

      Constructor for an iterator over the items of a dataset that are within the dimensions
      Parameters:
        `shape` - to use
        `length` - of entire data array
        `isize` - number of elements in an item

  - ### 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 not a copy)

    - #### 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–2022 Eclipse Foundation. All rights reserved.