Class IntersectBlockReader.AutomatonNextTermCalculator
- java.lang.Object
-
- org.apache.lucene.codecs.uniformsplit.IntersectBlockReader.AutomatonNextTermCalculator
-
- Enclosing class:
- IntersectBlockReader
protected static class IntersectBlockReader.AutomatonNextTermCalculator extends java.lang.Object
This is a copy of AutomatonTermsEnum. Since it's an inner class, the outer class can call methods that ATE does not expose. It'd be nice if ATE's logic could be more extensible.
-
-
Field Summary
Fields Modifier and Type Field Description protected Automaton
automaton
protected BytesRef
commonSuffixRef
protected long
curGen
protected boolean
finite
protected boolean
linear
protected BytesRef
linearUpperBound
protected ByteRunAutomaton
runAutomaton
protected IntsRefBuilder
savedStates
protected BytesRefBuilder
seekBytesRef
protected Transition
transition
protected long[]
visited
-
Constructor Summary
Constructors Modifier Constructor Description protected
AutomatonNextTermCalculator(CompiledAutomaton compiled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
backtrack(int position)
Attempts to backtrack thru the string after encountering a dead end at some given position.protected boolean
isLinearState(BytesRef term)
True if the current state of the automata is best iterated linearly (without seeking).protected BytesRef
nextSeekTerm(BytesRef term)
protected boolean
nextString()
Increments the byte buffer to the next String in binary order after s that will not put the machine into a reject state.protected boolean
nextString(int state, int position)
Returns the next String in lexicographic order that will not put the machine into a reject state.protected void
setLinear(int position)
Sets the enum to operate in linear fashion, as we have found a looping transition at position: we set an upper bound and act like a TermRangeQuery for this portion of the term space.
-
-
-
Field Detail
-
runAutomaton
protected final ByteRunAutomaton runAutomaton
-
commonSuffixRef
protected final BytesRef commonSuffixRef
-
finite
protected final boolean finite
-
automaton
protected final Automaton automaton
-
visited
protected final long[] visited
-
curGen
protected long curGen
-
seekBytesRef
protected final BytesRefBuilder seekBytesRef
-
linear
protected boolean linear
-
linearUpperBound
protected final BytesRef linearUpperBound
-
transition
protected Transition transition
-
savedStates
protected final IntsRefBuilder savedStates
-
-
Constructor Detail
-
AutomatonNextTermCalculator
protected AutomatonNextTermCalculator(CompiledAutomaton compiled)
-
-
Method Detail
-
isLinearState
protected boolean isLinearState(BytesRef term)
True if the current state of the automata is best iterated linearly (without seeking).
-
nextSeekTerm
protected BytesRef nextSeekTerm(BytesRef term) throws java.io.IOException
- Throws:
java.io.IOException
- See Also:
FilteredTermsEnum.nextSeekTerm(BytesRef)
-
setLinear
protected void setLinear(int position)
Sets the enum to operate in linear fashion, as we have found a looping transition at position: we set an upper bound and act like a TermRangeQuery for this portion of the term space.
-
nextString
protected boolean nextString()
Increments the byte buffer to the next String in binary order after s that will not put the machine into a reject state. If such a string does not exist, returns false. The correctness of this method depends upon the automaton being deterministic, and having no transitions to dead states.- Returns:
- true if more possible solutions exist for the DFA
-
nextString
protected boolean nextString(int state, int position)
Returns the next String in lexicographic order that will not put the machine into a reject state. This method traverses the DFA from the given position in the String, starting at the given state. If this cannot satisfy the machine, returns false. This method will walk the minimal path, in lexicographic order, as long as possible. If this method returns false, then there might still be more solutions, it is necessary to backtrack to find out.- Parameters:
state
- current non-reject stateposition
- useful portion of the string- Returns:
- true if more possible solutions exist for the DFA from this position
-
backtrack
protected int backtrack(int position)
Attempts to backtrack thru the string after encountering a dead end at some given position. Returns false if no more possible strings can match.- Parameters:
position
- current position in the input String- Returns:
position >= 0
if more possible solutions exist for the DFA
-
-