Package jflex.state
Class StateSetEnumerator
- java.lang.Object
-
- jflex.state.StateSetEnumerator
-
- All Implemented Interfaces:
Iterator<Integer>,PrimitiveIterator<Integer,IntConsumer>,PrimitiveIterator.OfInt
public final class StateSetEnumerator extends Object implements PrimitiveIterator.OfInt
Enumerates the states of aStateSet. Also provides an iterator for native int.- Version:
- JFlex 1.8.2
- Author:
- Gerwin Klein
- See Also:
StateSet
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong
-
-
Constructor Summary
Constructors Constructor Description StateSetEnumerator()Creates a new StateSetEnumerator that is not yet associated with a StateSet.StateSetEnumerator(StateSet states)Construct a StateSetEnumerator for a given StateSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasMoreElements()Determine if there are further elements in the set to be returned.booleanhasNext()Iterator interface method fornextElement().intnextElement()Return the next element from the set.intnextInt()Iterator interface method forhasMoreElements()voidreset(StateSet states)Reset this enumerator/iterator and associate it with a given StateSet.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining, forEachRemaining, next
-
-
-
-
Constructor Detail
-
StateSetEnumerator
public StateSetEnumerator()
Creates a new StateSetEnumerator that is not yet associated with a StateSet.hasMoreElements()andnextElement()will throwNullPointerExceptionwhen used beforereset(StateSet)
-
StateSetEnumerator
public StateSetEnumerator(StateSet states)
Construct a StateSetEnumerator for a given StateSet. This should be the default constructor to use.- Parameters:
states- theStateSetobject to iterate over.- See Also:
StateSet.states()
-
-
Method Detail
-
reset
public void reset(StateSet states)
Reset this enumerator/iterator and associate it with a given StateSet.- Parameters:
states- theStateSetobject to iterate over.
-
hasMoreElements
public boolean hasMoreElements()
Determine if there are further elements in the set to be returned.- Returns:
- true iff there are more elements in the set.
-
nextElement
public int nextElement()
Return the next element from the set.Precondition:
hasMoreElements()returns true- Returns:
- the next element.
- Throws:
NoSuchElementException- if there is no further element- See Also:
hasMoreElements()
-
hasNext
public boolean hasNext()
Iterator interface method fornextElement().
-
nextInt
public int nextInt()
Iterator interface method forhasMoreElements()- Specified by:
nextIntin interfacePrimitiveIterator.OfInt
-
-