Class PointNFloatIterator

java.lang.Object
com.github.yellowstonegames.grid.PointNFloatIterator
All Implemented Interfaces:
com.github.tommyettinger.ds.support.util.FloatIterator, Iterator<Float>

public class PointNFloatIterator extends Object implements com.github.tommyettinger.ds.support.util.FloatIterator
A FloatIterator that iterates over the components in a PointNFloat using PointNFloat.get(int).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Which index this will return next.
    The PointNFloat this can iterate through.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new PointNFloatIterator over the given PointNFloat that starts at index 0.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the iteration has more elements.
    float
    Returns the next float element in the iteration.
    void
     
    void
    set(float newValue)
    After nextFloat() has been called, you can call this to change the value at the same position last returned by nextFloat().

    Methods inherited from class Object

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

    Methods inherited from interface com.github.tommyettinger.ds.support.util.FloatIterator

    forEachRemaining, next

    Methods inherited from interface Iterator

    forEachRemaining, remove
  • Field Details

    • pt

      public PointNFloat<?,?> pt
      The PointNFloat this can iterate through.
    • index

      public int index
      Which index this will return next.
  • Constructor Details

    • PointNFloatIterator

      public PointNFloatIterator(PointNFloat<?,?> pt)
      Constructs a new PointNFloatIterator over the given PointNFloat that starts at index 0.
      Parameters:
      pt - the PointNFloat to iterate over
  • Method Details

    • nextFloat

      public float nextFloat()
      Returns the next float element in the iteration. Unlike most FloatIterator types, this typically won't throw an Exception if the iterator is exhausted. You should still use hasNext() to determine when the iterator has exhausted the available items.
      Specified by:
      nextFloat in interface com.github.tommyettinger.ds.support.util.FloatIterator
      Returns:
      the next float element in the iteration
    • hasNext

      public boolean hasNext()
      Returns true if the iteration has more elements. (In other words, if nextFloat()) has been called fewer times than PointN.rank()).
      Specified by:
      hasNext in interface Iterator<Float>
      Returns:
      true if the iteration has more elements
    • set

      public void set(float newValue)
      After nextFloat() has been called, you can call this to change the value at the same position last returned by nextFloat(). If nextFloat() has not yet been called, this does not have defined behavior, and is permitted to throw an Exception.
      Parameters:
      newValue - the value to use at the last returned index
    • reset

      public void reset()