Class BasicOperations
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddEpsilons(Automaton a, Collection<StatePair> pairs) Adds epsilon transitions to the given automaton.static AutomatonReturns a (deterministic) automaton that accepts the complement of the language of the given automaton.static Automatonconcatenate(List<Automaton> l) Returns an automaton that accepts the concatenation of the languages of the given automata.static Automatonconcatenate(Automaton a1, Automaton a2) Returns an automaton that accepts the concatenation of the languages of the given automata.static voidDeterminizes the given automaton.static Automatonintersection(Automaton a1, Automaton a2) Returns an automaton that accepts the intersection of the languages of the given automata.static booleanReturns true if the given automaton accepts no strings.static booleanReturns true if the given automaton accepts the empty string and nothing else.static booleanReturns true if the given automaton accepts all strings.static AutomatonReturns a (deterministic) automaton that accepts the intersection of the language ofa1and the complement of the language ofa2.static AutomatonReturns an automaton that accepts the union of the empty string and the language of the given automaton.static AutomatonReturns an automaton that accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton.static AutomatonReturns an automaton that acceptsminor more concatenated repetitions of the language of the given automaton.static AutomatonReturns an automaton that accepts betweenminandmax(including both) concatenated repetitions of the language of the given automaton.static booleanReturns true if the given string is accepted by the automaton.static booleansameLanguage(Automaton a1, Automaton a2) Returns true if these two automata accept exactly the same language.static booleanReturns true if the language ofa1is a subset of the language ofa2.static Automatonunion(Collection<Automaton> l) Returns an automaton that accepts the union of the languages of the given automata.static AutomatonReturns an automaton that accepts the union of the languages of the given automata.
-
Method Details
-
concatenate
Returns an automaton that accepts the concatenation of the languages of the given automata.Complexity: linear in number of states.
-
concatenate
Returns an automaton that accepts the concatenation of the languages of the given automata.Complexity: linear in total number of states.
-
optional
Returns an automaton that accepts the union of the empty string and the language of the given automaton.Complexity: linear in number of states.
-
repeat
Returns an automaton that accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton. Never modifies the input automaton language.Complexity: linear in number of states.
-
repeat
Returns an automaton that acceptsminor more concatenated repetitions of the language of the given automaton.Complexity: linear in number of states and in
min. -
repeat
Returns an automaton that accepts betweenminandmax(including both) concatenated repetitions of the language of the given automaton.Complexity: linear in number of states and in
minandmax. -
complement
Returns a (deterministic) automaton that accepts the complement of the language of the given automaton.Complexity: linear in number of states (if already deterministic).
-
minus
Returns a (deterministic) automaton that accepts the intersection of the language ofa1and the complement of the language ofa2. As a side-effect, the automata may be determinized, if not already deterministic.Complexity: quadratic in number of states (if already deterministic).
-
intersection
Returns an automaton that accepts the intersection of the languages of the given automata. Never modifies the input automata languages.Complexity: quadratic in number of states.
-
sameLanguage
Returns true if these two automata accept exactly the same language. This is a costly computation! Note also that a1 and a2 will be determinized as a side effect. -
subsetOf
Returns true if the language ofa1is a subset of the language ofa2. As a side-effect,a2is determinized if not already marked as deterministic.Complexity: quadratic in number of states.
-
union
Returns an automaton that accepts the union of the languages of the given automata.Complexity: linear in number of states.
-
union
Returns an automaton that accepts the union of the languages of the given automata.Complexity: linear in number of states.
-
determinize
Determinizes the given automaton.Worst case complexity: exponential in number of states.
-
addEpsilons
Adds epsilon transitions to the given automaton. This method adds extra character interval transitions that are equivalent to the given set of epsilon transitions.- Parameters:
pairs- collection ofStatePairobjects representing pairs of source/destination states where epsilon transitions should be added
-
isEmptyString
Returns true if the given automaton accepts the empty string and nothing else. -
isEmpty
Returns true if the given automaton accepts no strings. -
isTotal
Returns true if the given automaton accepts all strings. -
run
Returns true if the given string is accepted by the automaton.Complexity: linear in the length of the string.
Note: for full performance, use the
RunAutomatonclass.
-