Class IndexedTensor.SubspaceIterator

  • All Implemented Interfaces:
    java.util.Iterator<Tensor.Cell>
    Enclosing class:
    IndexedTensor

    public final class IndexedTensor.SubspaceIterator
    extends java.lang.Object
    implements java.util.Iterator<Tensor.Cell>
    An iterator over a subspace of this tensor. This is exposed to allow clients to query the size. NOTE THAT the Cell returned by next is only valid until the next() call is made. This is a concession to performance due to this typically being used in inner loops.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TensorAddress address()
      Returns the address of the cell this currently points to (which may be an invalid position)
      boolean hasNext()  
      Tensor.Cell next()
      Returns the next cell, which is valid until next() is called again
      void reset()
      Rewind this iterator to the first element
      long size()
      Returns the total number of cells in this subspace
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Method Detail

      • size

        public long size()
        Returns the total number of cells in this subspace
      • address

        public TensorAddress address()
        Returns the address of the cell this currently points to (which may be an invalid position)
      • reset

        public void reset()
        Rewind this iterator to the first element
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<Tensor.Cell>
      • next

        public Tensor.Cell next()
        Returns the next cell, which is valid until next() is called again
        Specified by:
        next in interface java.util.Iterator<Tensor.Cell>