Class PointNFloatIterator
java.lang.Object
com.github.yellowstonegames.grid.PointNFloatIterator
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
FieldsModifier and TypeFieldDescriptionintWhich index this will return next.PointNFloat<?, ?> The PointNFloat this can iterate through. -
Constructor Summary
ConstructorsConstructorDescriptionPointNFloatIterator(PointNFloat<?, ?> pt) Constructs a new PointNFloatIterator over the given PointNFloat that starts at index 0. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Returns true if the iteration has more elements.floatReturns the next float element in the iteration.voidreset()voidset(float newValue) AfternextFloat()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, waitMethods inherited from interface com.github.tommyettinger.ds.support.util.FloatIterator
forEachRemaining, nextMethods inherited from interface Iterator
forEachRemaining, remove
-
Field Details
-
pt
The PointNFloat this can iterate through. -
index
public int indexWhich index this will return next.
-
-
Constructor Details
-
PointNFloatIterator
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 usehasNext()to determine when the iterator has exhausted the available items.- Specified by:
nextFloatin interfacecom.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, ifnextFloat()) has been called fewer times thanPointN.rank()). -
set
public void set(float newValue) AfternextFloat()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()
-