public final class Automata extends Object
Modifier and Type | Method and Description |
---|---|
static int |
appendAnyChar(Automaton a,
int state)
Accept any single character starting from the specified state, returning the new state
|
static int |
appendChar(Automaton a,
int state,
int c)
Appends the specified character to the specified state, returning a new state.
|
static Automaton |
makeAnyBinary()
Returns a new (deterministic) automaton that accepts all binary terms.
|
static Automaton |
makeAnyChar()
Returns a new (deterministic) automaton that accepts any single codepoint.
|
static Automaton |
makeAnyString()
Returns a new (deterministic) automaton that accepts all strings.
|
static Automaton |
makeBinary(BytesRef term)
Returns a new (deterministic) automaton that accepts the single given
binary term.
|
static Automaton |
makeBinaryInterval(BytesRef min,
boolean minInclusive,
BytesRef max,
boolean maxInclusive)
Creates a new deterministic, minimal automaton accepting
all binary terms in the specified interval.
|
static Automaton |
makeChar(int c)
Returns a new (deterministic) automaton that accepts a single codepoint of
the given value.
|
static Automaton |
makeCharRange(int min,
int max)
Returns a new (deterministic) automaton that accepts a single codepoint whose
value is in the given interval (including both end points).
|
static Automaton |
makeDecimalInterval(int min,
int max,
int digits)
Returns a new automaton that accepts strings representing decimal (base 10)
non-negative integers in the given interval.
|
static Automaton |
makeEmpty()
Returns a new (deterministic) automaton with the empty language.
|
static Automaton |
makeEmptyString()
Returns a new (deterministic) automaton that accepts only the empty string.
|
static Automaton |
makeNonEmptyBinary()
Returns a new (deterministic) automaton that accepts all binary terms except
the empty string.
|
static Automaton |
makeString(int[] word,
int offset,
int length)
Returns a new (deterministic) automaton that accepts the single given
string from the specified unicode code points.
|
static Automaton |
makeString(String s)
Returns a new (deterministic) automaton that accepts the single given
string.
|
static Automaton |
makeStringUnion(Collection<BytesRef> utf8Strings)
Returns a new (deterministic and minimal) automaton that accepts the union
of the given collection of
BytesRef s representing UTF-8 encoded
strings. |
public static Automaton makeEmpty()
public static Automaton makeEmptyString()
public static Automaton makeAnyString()
public static Automaton makeAnyBinary()
public static Automaton makeNonEmptyBinary()
public static Automaton makeAnyChar()
public static int appendAnyChar(Automaton a, int state)
public static Automaton makeChar(int c)
public static int appendChar(Automaton a, int state, int c)
public static Automaton makeCharRange(int min, int max)
public static Automaton makeBinaryInterval(BytesRef min, boolean minInclusive, BytesRef max, boolean maxInclusive)
makeDecimalInterval(int, int, int)
, the returned automaton is infinite,
because terms behave like floating point numbers leading with
a decimal point. However, in the special case where min == max,
and both are inclusive, the automata will be finite and accept
exactly one term.public static Automaton makeDecimalInterval(int min, int max, int digits) throws IllegalArgumentException
min
- minimal value of intervalmax
- maximal value of interval (both end points are included in the
interval)digits
- if > 0, use fixed number of digits (strings must be prefixed
by 0's to obtain the right length) - otherwise, the number of
digits is not fixed (any number of leading 0s is accepted)IllegalArgumentException
- if min > max or if numbers in the
interval cannot be expressed with the given fixed number of
digitspublic static Automaton makeString(String s)
public static Automaton makeBinary(BytesRef term)
public static Automaton makeString(int[] word, int offset, int length)
public static Automaton makeStringUnion(Collection<BytesRef> utf8Strings)
BytesRef
s representing UTF-8 encoded
strings.utf8Strings
- The input strings, UTF-8 encoded. The collection must be in sorted
order.Automaton
accepting all input strings. The resulting
automaton is codepoint based (full unicode codepoints on
transitions).Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.