Package dk.brics.automaton
Class BasicAutomata
java.lang.Object
dk.brics.automaton.BasicAutomata
Construction of basic automata.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AutomatonReturns a new (deterministic) automaton that accepts any single character.static AutomatonReturns a new (deterministic) automaton that accepts all strings.static AutomatonmakeChar(char c) Returns a new (deterministic) automaton that accepts a single character of the given value.static AutomatonmakeCharRange(char min, char max) Returns a new (deterministic) automaton that accepts a single char whose value is in the given interval (including both end points).static AutomatonmakeCharSet(String set) Returns a new (deterministic) automaton that accepts a single character in the given set.static AutomatonmakeDecimalValue(String value) Constructs automaton that accept strings representing the given decimal number.static AutomatonReturns a new (deterministic) automaton with the empty language.static AutomatonReturns a new (deterministic) automaton that accepts only the empty string.static AutomatonmakeFractionDigits(int i) Constructs automaton that accept strings representing decimal numbers that can be written with at most the given number of digits in the fraction part.static AutomatonmakeIntegerValue(String value) Constructs automaton that accept strings representing the given integer.static AutomatonmakeInterval(int min, int max, int digits) Returns a new automaton that accepts strings representing decimal non-negative integers in the given interval.static AutomatonConstructs automaton that accept strings representing nonnegative integers that are not larger than the given value.static AutomatonConstructs automaton that accept strings representing nonnegative integers that are not less that the given value.static AutomatonmakeString(String s) Returns a new (deterministic) automaton that accepts the single given string.static AutomatonConstructs deterministic automaton that matches strings that contain the given substring.static AutomatonmakeStringUnion(CharSequence... strings) Returns a new (deterministic and minimal) automaton that accepts the union of the given set of strings.static AutomatonmakeTotalDigits(int i) Constructs automaton that accept strings representing decimal numbers that can be written with at most the given number of digits.
-
Method Details
-
makeEmpty
Returns a new (deterministic) automaton with the empty language. -
makeEmptyString
Returns a new (deterministic) automaton that accepts only the empty string. -
makeAnyString
Returns a new (deterministic) automaton that accepts all strings. -
makeAnyChar
Returns a new (deterministic) automaton that accepts any single character. -
makeChar
Returns a new (deterministic) automaton that accepts a single character of the given value. -
makeCharRange
Returns a new (deterministic) automaton that accepts a single char whose value is in the given interval (including both end points). -
makeCharSet
Returns a new (deterministic) automaton that accepts a single character in the given set. -
makeInterval
Returns a new automaton that accepts strings representing decimal non-negative integers in the given interval.- Parameters:
min- minimal value of intervalmax- maximal value of inverval (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- Throws:
IllegalArgumentException- if min>max or if numbers in the interval cannot be expressed with the given fixed number of digits
-
makeString
Returns a new (deterministic) automaton that accepts the single given string. -
makeStringUnion
Returns a new (deterministic and minimal) automaton that accepts the union of the given set of strings. The input character sequences are internally sorted in-place, so the input array is modified.- See Also:
-
makeMaxInteger
Constructs automaton that accept strings representing nonnegative integers that are not larger than the given value.- Parameters:
n- string representation of maximum value
-
makeMinInteger
Constructs automaton that accept strings representing nonnegative integers that are not less that the given value.- Parameters:
n- string representation of minimum value
-
makeTotalDigits
Constructs automaton that accept strings representing decimal numbers that can be written with at most the given number of digits. Surrounding whitespace is permitted.- Parameters:
i- max number of necessary digits
-
makeFractionDigits
Constructs automaton that accept strings representing decimal numbers that can be written with at most the given number of digits in the fraction part. Surrounding whitespace is permitted.- Parameters:
i- max number of necessary fraction digits
-
makeIntegerValue
Constructs automaton that accept strings representing the given integer. Surrounding whitespace is permitted.- Parameters:
value- string representation of integer
-
makeDecimalValue
Constructs automaton that accept strings representing the given decimal number. Surrounding whitespace is permitted.- Parameters:
value- string representation of decimal number
-
makeStringMatcher
Constructs deterministic automaton that matches strings that contain the given substring.
-