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,TermAutomatonScorer.TermRunAutomaton
public abstract class RunAutomaton extends java.lang.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) boolean[]accept(package private) intalphabetSize(package private) Automatonautomatonprivate static longBASE_RAM_BYTES(package private) int[]classmap(package private) int[]points(package private) intsize(package private) int[]transitions-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRunAutomaton(Automaton a, int alphabetSize)Constructs a newRunAutomatonfrom a deterministicAutomaton.protectedRunAutomaton(Automaton a, int alphabetSize, int maxDeterminizedStates)Constructs a newRunAutomatonfrom a deterministicAutomaton.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)(package private) intgetCharClass(int c)Gets character class of given codepointint[]getCharIntervals()Returns array of codepoint class interval start points.intgetSize()Returns number of states in automaton.inthashCode()booleanisAccept(int state)Returns acceptance status for given state.longramBytesUsed()Return the memory usage of this object in bytes.intstep(int state, int c)Returns the state obtained by reading the given char from the given state.java.lang.StringtoString()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 Detail
-
BASE_RAM_BYTES
private static final long BASE_RAM_BYTES
-
automaton
final Automaton automaton
-
alphabetSize
final int alphabetSize
-
size
final int size
-
accept
final boolean[] accept
-
transitions
final int[] transitions
-
points
final int[] points
-
classmap
final int[] classmap
-
-
Constructor Detail
-
RunAutomaton
protected RunAutomaton(Automaton a, int alphabetSize)
Constructs a newRunAutomatonfrom a deterministicAutomaton.- Parameters:
a- an automaton
-
RunAutomaton
protected RunAutomaton(Automaton a, int alphabetSize, int maxDeterminizedStates)
Constructs a newRunAutomatonfrom a deterministicAutomaton.- Parameters:
a- an automatonmaxDeterminizedStates- maximum number of states that can be created while determinizing a
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representation of this automaton.- Overrides:
toStringin classjava.lang.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.
-
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 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()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
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
-
-