Class IntersectBlockReader.AutomatonNextTermCalculator
java.lang.Object
org.apache.lucene.codecs.uniformsplit.IntersectBlockReader.AutomatonNextTermCalculator
- Enclosing class:
- IntersectBlockReader
This is mostly 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
Modifier and TypeFieldDescriptionprotected short
protected boolean
protected final BytesRef
protected final IntsRefBuilder
protected final BytesRefBuilder
protected final Transition
protected final short[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 boolean
isVisited
(int state) Indicates whether the given state has been visited.protected BytesRef
nextSeekTerm
(BytesRef term) protected boolean
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.protected void
setVisited
(int state) Records the given state has been visited.
-
Field Details
-
visited
protected final short[] visited -
curGen
protected short curGen -
seekBytesRef
-
linear
protected boolean linear -
linearUpperBound
-
transition
-
savedStates
-
-
Constructor Details
-
AutomatonNextTermCalculator
-
-
Method Details
-
setVisited
protected void setVisited(int state) Records the given state has been visited. -
isVisited
protected boolean isVisited(int state) Indicates whether the given state has been visited. -
isLinearState
True if the current state of the automata is best iterated linearly (without seeking). -
nextSeekTerm
- See Also:
-
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
-