Class IntersectBlockReader.AutomatonNextTermCalculator

  • Enclosing class:

    protected class IntersectBlockReader.AutomatonNextTermCalculator
    extends Object
    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 Detail

      • visited

        protected final short[] visited
      • curGen

        protected short curGen
      • linear

        protected boolean linear
      • linearUpperBound

        protected final BytesRef linearUpperBound
      • transition

        protected final Transition transition
    • Constructor Detail

      • AutomatonNextTermCalculator

        protected AutomatonNextTermCalculator​(CompiledAutomaton compiled)
    • Method Detail

      • 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

        protected boolean isLinearState​(BytesRef term)
        True if the current state of the automata is best iterated linearly (without seeking).
      • 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.

        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.

        state - current non-reject state
        position - useful portion of the string
        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.
        position - current position in the input String
        position >= 0 if more possible solutions exist for the DFA