java.lang.Object
org.apache.lucene.util.automaton.FiniteStringsIterator
- Direct Known Subclasses:
LimitedFiniteStringsIterator
Iterates all accepted strings.
If the Automaton has cycles then this iterator may throw an
IllegalArgumentException, but this is not guaranteed!
Be aware that the iteration order is implementation dependent and may change across releases.
If the automaton is not determinized then it's possible this iterator will return duplicates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classNodes for path stack. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AutomatonAutomaton to create finite string from.private booleanEmit empty string?.private static final IntsRefEmpty string.private final intThe state where each path should stop or -1 if only accepted states should be final.private FiniteStringsIterator.PathNode[]Stack to hold our current state in the recursion/iteration.private final BitSetTracks which states are in the current path, for cycle detection.private final IntsRefBuilderBuilder for current finite string. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.FiniteStringsIterator(Automaton a, int startState, int endState) Constructor. -
Method Summary
-
Field Details
-
EMPTY
Empty string. -
a
Automaton to create finite string from. -
endState
private final int endStateThe state where each path should stop or -1 if only accepted states should be final. -
pathStates
Tracks which states are in the current path, for cycle detection. -
string
Builder for current finite string. -
nodes
Stack to hold our current state in the recursion/iteration. -
emitEmptyString
private boolean emitEmptyStringEmit empty string?.
-
-
Constructor Details
-
FiniteStringsIterator
Constructor.- Parameters:
a- Automaton to create finite string from.
-
FiniteStringsIterator
Constructor.- Parameters:
a- Automaton to create finite string from.startState- The starting state for each path.endState- The state where each path should stop or -1 if only accepted states should be final.
-
-
Method Details
-
next
Generate next finite string. The return value is just valid until the next call of this method!- Returns:
- Finite string or null, if no more finite strings are available.
-
growStack
private void growStack(int depth) Grow path stack, if required.
-