public class FiniteAutomatonUtility
extends java.lang.Object
FiniteAutomaton instances.| Modifier and Type | Method and Description |
|---|---|
static FiniteAutomaton |
concatenate(FiniteAutomaton a1,
FiniteAutomaton a2)
Get a finite automaton accepting the concatenation of the languages of two automatons.
|
static DeterministicFiniteAutomaton |
constructDFA(FiniteAutomaton a)
Construct a deterministic finite automaton from a general finite automaton via the powerset construction.
|
static java.util.List<java.lang.String> |
findPredicateWord(FiniteAutomaton a,
org.apache.commons.collections4.Predicate<java.util.List<java.lang.String>> prefixPredicate,
org.apache.commons.collections4.Predicate<java.util.List<java.lang.String>> wordPredicate)
Find a word whose prefixes (including the word) conform to a given predicate and which itself also conforms
to a second predicate.
|
static java.util.List<java.lang.String> |
findWordDifference(FiniteAutomaton a1,
FiniteAutomaton a2)
Find a word that is only accepted by one of the automatons.
|
static FiniteAutomaton |
fromLTS(TransitionSystem lts,
java.util.Collection<State> finalStates)
Construct a finite automaton from a transition system with final states.
|
static FiniteAutomaton |
fromPrefixLanguageLTS(TransitionSystem lts)
Construct a finite automaton from a transition system.
|
static FiniteAutomaton |
getAtomicLanguage(Symbol atom)
Get a finite automaton accepting just the word consisting of the given symbol.
|
static FiniteAutomaton |
getDifferenceAutomaton(FiniteAutomaton a1,
FiniteAutomaton a2)
Return a finite automaton that accepts all words which are only accepted by one of the automatons.
|
static FiniteAutomaton |
getEmptyLanguage()
Get a finite automaton accepting the empty language.
|
static DeterministicFiniteAutomaton |
intersection(DeterministicFiniteAutomaton a1,
DeterministicFiniteAutomaton a2)
Get a finite automaton accepting the intersection of the languages of two automatons.
|
static FiniteAutomaton |
intersection(FiniteAutomaton a1,
FiniteAutomaton a2)
Get a finite automaton accepting the intersection of the languages of two automatons.
|
static boolean |
isWordInLanguage(FiniteAutomaton a,
java.util.List<java.lang.String> word)
Test if a given word is accepted by a given finite automaton.
|
static FiniteAutomaton |
kleenePlus(FiniteAutomaton a)
Get a finite automaton accepting the kleene plus of the language of an automaton.
|
static FiniteAutomaton |
kleeneStar(FiniteAutomaton a)
Get a finite automaton accepting the kleene star of the language of an automaton.
|
static boolean |
languageEquivalent(FiniteAutomaton a1,
FiniteAutomaton a2)
Test if two automaton are language equivalent.
|
static DeterministicFiniteAutomaton |
minimize(FiniteAutomaton a)
Get the unique deterministic automaton with the minimal number of states that accepts the same language as
the given automaton.
|
static DeterministicFiniteAutomaton |
negate(DeterministicFiniteAutomaton a)
Get a finite automaton accepting the negation of the language of the given automaton.
|
static DeterministicFiniteAutomaton |
negate(DeterministicFiniteAutomaton a,
java.util.Set<Symbol> alphabet)
Get a finite automaton accepting the negation of the language of the given automaton.
|
static DeterministicFiniteAutomaton |
negate(FiniteAutomaton a,
java.util.Set<Symbol> alphabet)
Get a finite automaton accepting the negation of the language of the given automaton.
|
static DeterministicFiniteAutomaton |
optional(DeterministicFiniteAutomaton a)
Get a finite automaton accepting a word accepted by the given automaton or the empty word.
|
static FiniteAutomaton |
optional(FiniteAutomaton a)
Get a finite automaton accepting a word accepted by the given automaton or the empty word.
|
static DeterministicFiniteAutomaton |
prefixClosure(FiniteAutomaton a)
Get a finite automaton accepting the prefix closure of the language of the given automaton.
|
static TransitionSystem |
prefixLanguageLTS(FiniteAutomaton a)
Construct a transition system that describes the prefix language of the given finite automaton.
|
static java.lang.String |
renderToGraphviz(FiniteAutomaton aut)
Render a finite automaton in the Graphviz file format.
|
static FiniteAutomaton |
repeat(FiniteAutomaton a,
int min,
int max)
Get a finite automaton accepting repeatitions of the language of an automaton.
|
static java.lang.Iterable<DFAState> |
statesIterable(DeterministicFiniteAutomaton a)
Get an Iterable iterating over all of the automaton's states.
|
static java.lang.Iterable<uniol.apt.adt.automaton.State> |
statesIterable(FiniteAutomaton a)
Get an Iterable iterating over all of the automaton's states.
|
static DeterministicFiniteAutomaton |
union(DeterministicFiniteAutomaton a1,
DeterministicFiniteAutomaton a2)
Get a finite automaton accepting the union of the languages of two automatons.
|
static FiniteAutomaton |
union(FiniteAutomaton a1,
FiniteAutomaton a2)
Get a finite automaton accepting the union of the languages of two automatons.
|
public static FiniteAutomaton getEmptyLanguage()
public static FiniteAutomaton getAtomicLanguage(Symbol atom)
atom - The only symbol after which the automaton accepts.public static FiniteAutomaton union(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton of the union.a2 - The second automaton of the union.public static DeterministicFiniteAutomaton union(DeterministicFiniteAutomaton a1, DeterministicFiniteAutomaton a2)
a1 - The first automaton of the union.a2 - The second automaton of the union.public static FiniteAutomaton intersection(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton of the intersection.a2 - The second automaton of the intersection.public static DeterministicFiniteAutomaton intersection(DeterministicFiniteAutomaton a1, DeterministicFiniteAutomaton a2)
a1 - The first automaton of the intersection.a2 - The second automaton of the intersection.public static DeterministicFiniteAutomaton negate(DeterministicFiniteAutomaton a)
a - The automaton whose language is to negate.public static DeterministicFiniteAutomaton negate(FiniteAutomaton a, java.util.Set<Symbol> alphabet)
a - The automaton whose language is to negate.alphabet - The alphabet of the negationpublic static DeterministicFiniteAutomaton negate(DeterministicFiniteAutomaton a, java.util.Set<Symbol> alphabet)
a - The automaton whose language is to negate.alphabet - The alphabet of the negationpublic static FiniteAutomaton concatenate(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton of the concatenation.a2 - The second automaton of the concatenation.public static FiniteAutomaton kleeneStar(FiniteAutomaton a)
a - The automaton to iteratepublic static FiniteAutomaton kleenePlus(FiniteAutomaton a)
a - The automaton to iteratepublic static FiniteAutomaton repeat(FiniteAutomaton a, int min, int max)
a - The automaton to repeatmin - minimum number of repeatitionsmax - maximum number of repeatitionspublic static FiniteAutomaton optional(FiniteAutomaton a)
a - The automatonpublic static DeterministicFiniteAutomaton optional(DeterministicFiniteAutomaton a)
a - The automatonpublic static boolean isWordInLanguage(FiniteAutomaton a, java.util.List<java.lang.String> word)
a - The automaton to use.word - The word to checkpublic static DeterministicFiniteAutomaton constructDFA(FiniteAutomaton a)
a - the automaton to determinizepublic static DeterministicFiniteAutomaton minimize(FiniteAutomaton a)
a - the automaton to minimizepublic static DeterministicFiniteAutomaton prefixClosure(FiniteAutomaton a)
a - The automaton whose prefix closure should be generated.public static boolean languageEquivalent(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton to test witha2 - The second automaton to test withpublic static FiniteAutomaton getDifferenceAutomaton(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton to test witha2 - The second automaton to test withpublic static java.util.List<java.lang.String> findWordDifference(FiniteAutomaton a1, FiniteAutomaton a2)
a1 - The first automaton to test witha2 - The second automaton to test withpublic static java.util.List<java.lang.String> findPredicateWord(FiniteAutomaton a, org.apache.commons.collections4.Predicate<java.util.List<java.lang.String>> prefixPredicate, org.apache.commons.collections4.Predicate<java.util.List<java.lang.String>> wordPredicate)
a - The automaton whose accepted words should get checked.prefixPredicate - The predicate to check the prefixes.wordPredicate - The predicate to check the words.public static TransitionSystem prefixLanguageLTS(FiniteAutomaton a)
a - The automaton whose prefix language should be generated.public static FiniteAutomaton fromPrefixLanguageLTS(TransitionSystem lts)
lts - The transition system to transform.public static FiniteAutomaton fromLTS(TransitionSystem lts, java.util.Collection<State> finalStates)
lts - The transition system to transform.finalStates - Sequences reaching a state from this collection are accepted.public static java.lang.String renderToGraphviz(FiniteAutomaton aut)
aut - The automaton to renderpublic static java.lang.Iterable<uniol.apt.adt.automaton.State> statesIterable(FiniteAutomaton a)
a - The automaton whose states should be iteratedpublic static java.lang.Iterable<DFAState> statesIterable(DeterministicFiniteAutomaton a)
a - The automaton whose states should be iterated