IntersectBlockReader.AutomatonNextTermCalculator (Lucene 10.5.0 codecs API)
Description: declaration: package: org.apache.lucene.codecs.uniformsplit, class: IntersectBlockReader, class: AutomatonNextTermCalculator

Package org.apache.lucene.codecs.uniformsplit

# Class IntersectBlockReader.AutomatonNextTermCalculator

java.lang.Object
org.apache.lucene.codecs.uniformsplit.IntersectBlockReader.AutomatonNextTermCalculator

Enclosing class:
  `IntersectBlockReader`

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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected short`
  `curGen`
  `protected boolean`
  `linear`
  `protected final BytesRef`
  `linearUpperBound`
  `protected final IntsRefBuilder`
  `savedStates`
  `protected final BytesRefBuilder`
  `seekBytesRef`
  `protected final Transition`
  `transition`
  `protected short[]`
  `visited`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AutomatonNextTermCalculator(CompiledAutomaton compiled)`

- ## Method Summary

  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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### visited

    protected short[] visited

  - ### curGen

    protected short curGen

  - ### seekBytesRef

    protected final BytesRefBuilder seekBytesRef

  - ### linear

    protected boolean linear

  - ### linearUpperBound

    protected final BytesRef linearUpperBound

  - ### transition

    protected final Transition transition

  - ### savedStates

    protected final IntsRefBuilder savedStates

- ## Constructor Details

  - ### AutomatonNextTermCalculator

    protected AutomatonNextTermCalculator(CompiledAutomaton compiled)

- ## Method Details

  - ### 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)
    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 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