Package jflex.state
Class StateSetEnumerator
java.lang.Object
jflex.state.StateSetEnumerator
- All Implemented Interfaces:
Iterator<Integer>
,PrimitiveIterator<Integer,
,IntConsumer> PrimitiveIterator.OfInt
Enumerates the states of a
StateSet
. Also provides an iterator for native int.- Version:
- JFlex 1.8.2
- Author:
- Gerwin Klein
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new StateSetEnumerator that is not yet associated with a StateSet.StateSetEnumerator
(StateSet states) Construct a StateSetEnumerator for a given StateSet. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if there are further elements in the set to be returned.boolean
hasNext()
Iterator interface method fornextElement()
.int
Return the next element from the set.int
nextInt()
Iterator interface method forhasMoreElements()
void
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 Details
-
StateSetEnumerator
public StateSetEnumerator()Creates a new StateSetEnumerator that is not yet associated with a StateSet.hasMoreElements()
andnextElement()
will throwNullPointerException
when used beforereset(StateSet)
-
StateSetEnumerator
Construct a StateSetEnumerator for a given StateSet. This should be the default constructor to use.- Parameters:
states
- theStateSet
object to iterate over.- See Also:
-
-
Method Details
-
reset
Reset this enumerator/iterator and associate it with a given StateSet.- Parameters:
states
- theStateSet
object 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:
-
hasNext
public boolean hasNext()Iterator interface method fornextElement()
. -
nextInt
public int nextInt()Iterator interface method forhasMoreElements()
- Specified by:
nextInt
in interfacePrimitiveIterator.OfInt
-