Class CompiledAutomaton

  • All Implemented Interfaces:
    Accountable

    public class CompiledAutomaton
    extends Object
    implements Accountable
    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.
    • Constructor Detail

      • CompiledAutomaton

        public CompiledAutomaton​(Automaton automaton)
        Create this, passing simplify=true and finite=null, so that we try to simplify the automaton and determine if it is finite.
      • CompiledAutomaton

        public CompiledAutomaton​(Automaton automaton,
                                 Boolean finite,
                                 boolean simplify,
                                 int determinizeWorkLimit,
                                 boolean isBinary)
        Create this. If finite is null, we use Operations.isFinite(org.apache.lucene.util.automaton.Automaton) to determine whether it is finite. If simplify is true, we run possibly expensive operations to determine if the automaton is one the cases in CompiledAutomaton.AUTOMATON_TYPE. If simplify requires determinizing the automaton then at most determinizeWorkLimit effort will be spent. Any more than that will cause a TooComplexToDeterminizeException.
    • Method Detail

      • visit

        public void visit​(QueryVisitor visitor,
                          Query parent,
                          String field)
        Report back to a QueryVisitor how this automaton matches terms
      • floor

        public BytesRef floor​(BytesRef input,
                              BytesRefBuilder 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 bytes. 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).
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • ramBytesUsed

        public long ramBytesUsed()
        Description copied from interface: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
        Specified by:
        ramBytesUsed in interface Accountable