org.apache.lucene.util.automaton

## Class CompiledAutomaton

- java.lang.Object
- - org.apache.lucene.util.automaton.CompiledAutomaton

-     public class CompiledAutomaton
      extends Object

  Immutable class holding compiled details for a given Automaton. The Automaton is deterministic, must not have dead states but is not necessarily minimal.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CompiledAutomaton.AUTOMATON_TYPE` Automata are compiled into different internal forms for the most efficient execution depending upon the language they accept.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `BytesRef` | `commonSuffixRef` Shared common suffix accepted by the automaton.
    `Boolean` | `finite` Indicates if the automaton accepts a finite set of strings.
    `ByteRunAutomaton` | `runAutomaton` Matcher for quickly determining if a byte[] is accepted.
    `Transition[][]` | `sortedTransitions` Two dimensional array of transitions, indexed by state number for traversal.
    `BytesRef` | `term` For `CompiledAutomaton.AUTOMATON_TYPE.PREFIX`, this is the prefix term; for `CompiledAutomaton.AUTOMATON_TYPE.SINGLE` this is the singleton term.
    `CompiledAutomaton.AUTOMATON_TYPE` | `type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompiledAutomaton(Automaton automaton)`
    `CompiledAutomaton(Automaton automaton, Boolean finite, boolean simplify)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `BytesRef` | `floor(BytesRef input, BytesRef output)` Finds largest term accepted by this Automaton, that's <= the provided input term.
    `TermsEnum` | `getTermsEnum(Terms terms)`

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

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

- - ### Field Detail

    - #### type

          public final CompiledAutomaton.AUTOMATON_TYPE type

    - #### term

          public final BytesRef term

      For `CompiledAutomaton.AUTOMATON_TYPE.PREFIX`, this is the prefix term; for `CompiledAutomaton.AUTOMATON_TYPE.SINGLE` this is the singleton term.

    - #### runAutomaton

          public final ByteRunAutomaton runAutomaton

      Matcher for quickly determining if a byte[] is accepted. only valid for `CompiledAutomaton.AUTOMATON_TYPE.NORMAL`.

    - #### sortedTransitions

          public final Transition[][] sortedTransitions

      Two dimensional array of transitions, indexed by state number for traversal. The state numbering is consistent with `runAutomaton`. Only valid for `CompiledAutomaton.AUTOMATON_TYPE.NORMAL`.

    - #### commonSuffixRef

          public final BytesRef commonSuffixRef

      Shared common suffix accepted by the automaton. Only valid for `CompiledAutomaton.AUTOMATON_TYPE.NORMAL`, and only when the automaton accepts an infinite language.

    - #### finite

          public final Boolean finite

      Indicates if the automaton accepts a finite set of strings. Null if this was not computed. Only valid for `CompiledAutomaton.AUTOMATON_TYPE.NORMAL`.

  - ### Constructor Detail

    - #### CompiledAutomaton

          public CompiledAutomaton(Automaton automaton)

    - #### CompiledAutomaton

          public CompiledAutomaton(Automaton automaton,
                           Boolean finite,
                           boolean simplify)

  - ### Method Detail

    - #### getTermsEnum

          public TermsEnum getTermsEnum(Terms terms)
                                 throws IOException

      Throws:
        `IOException`

    - #### floor

          public BytesRef floor(BytesRef input,
                       BytesRef output)

      Finds largest term accepted by this Automaton, that's <= the provided input term. The result is placed in output; it's fine for output and input to point to the same BytesRef. The returned result is either the provided output, or null if there is no floor term (ie, the provided input term is before the first term accepted by this Automaton).

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.