Class RunAutomaton

java.lang.Object
org.apache.lucene.util.automaton.RunAutomaton
All Implemented Interfaces:
Accountable
Direct Known Subclasses:
ByteRunAutomaton, CharacterRunAutomaton, TermAutomatonScorer.TermRunAutomaton

public abstract class RunAutomaton extends Object implements Accountable
Finite-state automaton with fast run operation. The initial state is always 0.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final FixedBitSet
     
    (package private) final int
     
    (package private) final Automaton
     
    private static final long
     
    (package private) final int[]
     
    (package private) final int[]
     
    (package private) final int
     
    (package private) final int[]
     

    Fields inherited from interface org.apache.lucene.util.Accountable

    NULL_ACCOUNTABLE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    RunAutomaton(Automaton a, int alphabetSize)
    Constructs a new RunAutomaton from a deterministic Automaton.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    (package private) final int
    getCharClass(int c)
    Gets character class of given codepoint
    final int[]
    Returns array of codepoint class interval start points.
    final int
    Returns number of states in automaton.
    int
     
    final boolean
    isAccept(int state)
    Returns acceptance status for given state.
    long
    Return the memory usage of this object in bytes.
    final int
    step(int state, int c)
    Returns the state obtained by reading the given char from the given state.
    Returns a string representation of this automaton.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources
  • Field Details

    • BASE_RAM_BYTES

      private static final long BASE_RAM_BYTES
    • automaton

      final Automaton automaton
    • alphabetSize

      final int alphabetSize
    • size

      final int size
    • accept

      final FixedBitSet accept
    • transitions

      final int[] transitions
    • points

      final int[] points
    • classmap

      final int[] classmap
  • Constructor Details

    • RunAutomaton

      protected RunAutomaton(Automaton a, int alphabetSize)
      Constructs a new RunAutomaton from a deterministic Automaton.
      Parameters:
      a - an automaton
      Throws:
      IllegalArgumentException - if the automaton is not deterministic
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this automaton.
      Overrides:
      toString in class Object
    • getSize

      public final int getSize()
      Returns number of states in automaton.
    • isAccept

      public final boolean isAccept(int state)
      Returns acceptance status for given state.
      Parameters:
      state - the state
      Returns:
      whether the state is accepted
    • getCharIntervals

      public final int[] getCharIntervals()
      Returns array of codepoint class interval start points. The array should not be modified by the caller.
    • getCharClass

      final int getCharClass(int c)
      Gets character class of given codepoint
    • step

      public final int step(int state, int c)
      Returns the state obtained by reading the given char from the given state. Returns -1 if not obtaining any such state. (If the original Automaton had no dead states, -1 is returned here if and only if a dead state is entered in an equivalent automaton with a total transition function.)
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals 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