Class 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 Detail

      • commonSuffixRef

        protected final BytesRef commonSuffixRef
      • finite

        protected final boolean finite
      • automaton

        protected final Automaton automaton
      • visited

        protected final long[] visited
      • curGen

        protected long curGen
      • linear

        protected boolean linear
      • linearUpperBound

        protected final BytesRef linearUpperBound
    • 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).
      • 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 state
        position - 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