Class DaciukMihovAutomatonBuilder

java.lang.Object
org.apache.lucene.util.automaton.DaciukMihovAutomatonBuilder

public final class DaciukMihovAutomatonBuilder extends Object
Builds a minimal, deterministic Automaton that accepts a set of strings. The algorithm requires sorted input data, but is very fast (nearly linear with the input size).
See Also:
  • Field Details

  • Constructor Details

    • DaciukMihovAutomatonBuilder

      private DaciukMihovAutomatonBuilder()
      The default constructor is private. Use static methods directly.
  • Method Details

    • add

      public void add(CharsRef current)
      Add another character sequence to this automaton. The sequence must be lexicographically larger or equal compared to any previous sequences added to this automaton (the input must be sorted).
    • complete

      Finalize the automaton and return the root state. No more strings can be added to the builder after this call.
      Returns:
      Root automaton state.
    • convert

      Internal recursive traversal for conversion.
    • build

      public static Automaton build(Collection<BytesRef> input)
      Build a minimal, deterministic automaton from a sorted list of BytesRef representing strings in UTF-8. These strings must be binary-sorted.
    • setPrevious

      private boolean setPrevious(CharsRef current)
      Copy current into an internal buffer.
    • replaceOrRegister

      private void replaceOrRegister(DaciukMihovAutomatonBuilder.State state)
      Replace last child of state with an already registered state or stateRegistry the last child state.
    • addSuffix

      private void addSuffix(DaciukMihovAutomatonBuilder.State state, CharSequence current, int fromIndex)
      Add a suffix of current starting at fromIndex (inclusive) to state state.