public class CompiledAutomaton
extends java.lang.Object
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.
|
Modifier and Type | Field and Description |
---|---|
Automaton |
automaton
Two dimensional array of transitions, indexed by state
number for traversal.
|
BytesRef |
commonSuffixRef
Shared common suffix accepted by the automaton.
|
java.lang.Boolean |
finite
Indicates if the automaton accepts a finite set of strings.
|
ByteRunAutomaton |
runAutomaton
Matcher for quickly determining if a byte[] is accepted.
|
int |
sinkState
Which state, if any, accepts all suffixes, else -1.
|
BytesRef |
term
For
CompiledAutomaton.AUTOMATON_TYPE.SINGLE this is the singleton term. |
private Transition |
transition |
CompiledAutomaton.AUTOMATON_TYPE |
type
If simplify is true this will be the "simplified" type; else, this is NORMAL
|
Constructor and Description |
---|
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(Automaton automaton,
java.lang.Boolean finite,
boolean simplify)
Create this.
|
CompiledAutomaton(Automaton automaton,
java.lang.Boolean finite,
boolean simplify,
int maxDeterminizedStates,
boolean isBinary)
Create this.
|
Modifier and Type | Method and Description |
---|---|
private BytesRef |
addTail(int state,
BytesRefBuilder term,
int idx,
int leadLabel) |
boolean |
equals(java.lang.Object obj) |
private static int |
findSinkState(Automaton automaton)
Returns sink state, if present, else -1.
|
BytesRef |
floor(BytesRef input,
BytesRefBuilder output)
Finds largest term accepted by this Automaton, that's
<= the provided input term.
|
TermsEnum |
getTermsEnum(Terms terms)
|
int |
hashCode() |
public final CompiledAutomaton.AUTOMATON_TYPE type
public final BytesRef term
CompiledAutomaton.AUTOMATON_TYPE.SINGLE
this is the singleton term.public final ByteRunAutomaton runAutomaton
CompiledAutomaton.AUTOMATON_TYPE.NORMAL
.public final Automaton automaton
runAutomaton
.
Only valid for CompiledAutomaton.AUTOMATON_TYPE.NORMAL
.public final BytesRef commonSuffixRef
CompiledAutomaton.AUTOMATON_TYPE.NORMAL
, and only when the
automaton accepts an infinite language. This will be null
if the common prefix is length 0.public final java.lang.Boolean finite
CompiledAutomaton.AUTOMATON_TYPE.NORMAL
.public final int sinkState
private Transition transition
public CompiledAutomaton(Automaton automaton)
public CompiledAutomaton(Automaton automaton, java.lang.Boolean finite, boolean simplify)
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
.public CompiledAutomaton(Automaton automaton, java.lang.Boolean finite, boolean simplify, int maxDeterminizedStates, boolean isBinary)
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 only maxDeterminizedStates
will be created. Any more than that will cause a
TooComplexToDeterminizeException.private static int findSinkState(Automaton automaton)
private BytesRef addTail(int state, BytesRefBuilder term, int idx, int leadLabel)
public TermsEnum getTermsEnum(Terms terms) throws java.io.IOException
java.io.IOException
public BytesRef floor(BytesRef input, BytesRefBuilder output)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object