public class FiniteStringsIterator
extends java.lang.Object
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.
Modifier and Type | Class and Description |
---|---|
private static class |
FiniteStringsIterator.PathNode
Nodes for path stack.
|
Modifier and Type | Field and Description |
---|---|
private Automaton |
a
Automaton to create finite string from.
|
private boolean |
emitEmptyString
Emit empty string?.
|
private static IntsRef |
EMPTY
Empty string.
|
private int |
endState
The state where each path should stop or -1 if only accepted states should be final.
|
private FiniteStringsIterator.PathNode[] |
nodes
Stack to hold our current state in the recursion/iteration.
|
private java.util.BitSet |
pathStates
Tracks which states are in the current path, for cycle detection.
|
private IntsRefBuilder |
string
Builder for current finite string.
|
Constructor and Description |
---|
FiniteStringsIterator(Automaton a)
Constructor.
|
FiniteStringsIterator(Automaton a,
int startState,
int endState)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
growStack(int depth)
Grow path stack, if required.
|
IntsRef |
next()
Generate next finite string.
|
private static final IntsRef EMPTY
private final Automaton a
private final int endState
private final java.util.BitSet pathStates
private final IntsRefBuilder string
private FiniteStringsIterator.PathNode[] nodes
private boolean emitEmptyString
public FiniteStringsIterator(Automaton a)
a
- Automaton to create finite string from.public FiniteStringsIterator(Automaton a, int startState, int endState)
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.public IntsRef next()
private void growStack(int depth)