Package org.apache.lucene.util.automaton
Class RunAutomaton
java.lang.Object
org.apache.lucene.util.automaton.RunAutomaton
- All Implemented Interfaces:
Accountable
- Direct Known Subclasses:
ByteRunAutomaton,CharacterRunAutomaton
Finite-state automaton with fast run operation. The initial state is always 0.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRunAutomaton(Automaton a, int alphabetSize) Constructs a newRunAutomatonfrom a deterministicAutomaton. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal int[]Returns array of codepoint class interval start points.final intgetSize()Returns number of states in automaton.inthashCode()final booleanisAccept(int state) Returns acceptance status for given state.longReturn the memory usage of this object in bytes.final intstep(int state, int c) Returns the state obtained by reading the given char from the given state.toString()Returns a string representation of this automaton.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
RunAutomaton
Constructs a newRunAutomatonfrom a deterministicAutomaton.- Parameters:
a- an automaton- Throws:
IllegalArgumentException- if the automaton is not deterministic
-
-
Method Details
-
toString
Returns a string representation of this automaton. -
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. -
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 originalAutomatonhad 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() -
equals
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-