Table of Contents

Public classSealed PrefixAutomaton

Namespace
Rowles.LeanLucene.Codecs.Fst
Assembly
Rowles.LeanLucene.dll

Accepts any byte sequence that starts with a given UTF-8 prefix. States: 0..prefix.Length-1 = matching prefix bytes, prefix.Length = accepted (sink).

public sealed class PrefixAutomaton : IAutomaton
PrefixAutomaton
Implements

Public constructor PrefixAutomaton(ReadOnlySpan<byte>)

Initialises a new PrefixAutomaton from a raw UTF-8 byte prefix.

Public constructor PrefixAutomaton(string)

Initialises a new PrefixAutomaton from a string prefix, converted to UTF-8.

Public property Start

Initial state of the automaton.

Public method CanMatch(int)

Returns true if the automaton could potentially accept any string starting from the given state. Used for early pruning during intersection. Returns false only if the state is dead (no path to any accept state).

Public method IsAccept(int)

Returns true if the given state is an accepting state.

Public method Step(int, byte)

Transition function: returns next state given current state and input byte, or -1 if no transition.