CompiledAutomaton

class CompiledAutomaton(automaton: Automaton, finite: Boolean, simplify: Boolean, isBinary: Boolean) : Accountable

Immutable class holding compiled details for a given Automaton. The Automaton could either be deterministic or non-deterministic, For deterministic automaton, it must not have dead states but is not necessarily minimal. And will be executed using ByteRunAutomaton For non-deterministic automaton, it will be executed using NFARunAutomaton

Constructors

Link copied to clipboard
constructor(automaton: Automaton, finite: Boolean, simplify: Boolean, isBinary: Boolean)
constructor(automaton: Automaton)

Create this, passing simplify=true, so that we try to simplify the automaton.

constructor(automaton: Automaton, finite: Boolean, simplify: Boolean)

Create this. If simplify is true, we run possibly expensive operations to determine if the automaton is one the cases in AUTOMATON_TYPE. Set finite to true if the automaton is finite, otherwise set to false if infinite or you don't know.

Types

Link copied to clipboard

Automata are compiled into different internal forms for the most efficient execution depending upon the language they accept.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Two dimensional array of transitions, indexed by state number for traversal. The state numbering is consistent with .runAutomaton. Only valid for .

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard

Shared common suffix accepted by the automaton. Only valid for AUTOMATON_TYPE.NORMAL, and only when the automaton accepts an infinite language. This will be null if the common prefix is length 0.

Link copied to clipboard

Indicates if the automaton accepts a finite set of strings. Only valid for .

Link copied to clipboard

Matcher directly run on a NFA, it will determinize the state on need and caches it, note that this field and .runAutomaton will not be non-null at the same time

Link copied to clipboard

Matcher for quickly determining if a byte[] is accepted. only valid for .

Link copied to clipboard

Which state, if any, accepts all suffixes, else -1.

Link copied to clipboard

For AUTOMATON_TYPE.SINGLE this is the singleton term.

Link copied to clipboard

If simplify is true this will be the "simplified" type; else, this is NORMAL

Functions

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean
Link copied to clipboard
fun floor(input: BytesRef, output: BytesRefBuilder): BytesRef?

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).

Link copied to clipboard

Get a ByteRunnable instance, it will be different depending on whether a NFA or DFA is passed in, and does not guarantee returning non-null object

Link copied to clipboard

Return a TermsEnum intersecting the provided Terms with the terms accepted by this automaton.

Link copied to clipboard

Get a TransitionAccessor instance, it will be different depending on whether a NFA or DFA is passed in, and does not guarantee returning non-null object

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
fun visit(visitor: QueryVisitor, parent: Query, field: String)

Report back to a QueryVisitor how this automaton matches terms