public final class DFAs extends Object
DFA
s.
Note that the methods provided by this class do not modify their input arguments. Such methods are instead provided
by the MutableDFAs
class.
Modifier and Type | Method and Description |
---|---|
static <S> boolean |
acceptsEmptyLanguage(DFA<S,?> dfa)
Computes whether the given
DFA accepts the empty language. |
static <I> CompactDFA<I> |
and(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet)
Calculates the conjunction ("and") of two DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
and(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out)
Calculates the conjunction ("and") of two DFA, and stores the result in a given mutable DFA.
|
static <I> CompactDFA<I> |
combine(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet,
AcceptanceCombiner combiner)
Most general way of combining two DFAs.
|
static <I,S,A extends MutableDFA<S,I>> |
combine(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out,
AcceptanceCombiner combiner)
Most general way of combining two DFAs.
|
static <I> CompactDFA<I> |
complement(DFA<?,I> dfa,
Alphabet<I> inputAlphabet)
Calculates the complement (negation) of a DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
complement(DFA<?,I> dfa,
Collection<? extends I> inputs,
A out)
Calculates the complement (negation) of a DFA, and stores the result in a given mutable DFA.
|
static <I> CompactDFA<I> |
complete(DFA<?,I> dfa,
Alphabet<I> inputs) |
static <I,S,A extends MutableDFA<S,I>> |
complete(DFA<?,I> dfa,
Collection<? extends I> inputs,
A out) |
static <I> CompactDFA<I> |
equiv(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet)
Calculates the equivalence ("<=>") of two DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
equiv(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out)
Calculates the equivalence ("<=>") of two DFA, and stores the result in a given mutable DFA.
|
static <I> CompactDFA<I> |
impl(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet)
Calculates the implication ("=>") of two DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
impl(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out)
Calculates the implication ("=>") of two DFA, and stores the result in a given mutable DFA.
|
static <S,I> boolean |
isPrefixClosed(DFA<S,I> dfa,
Alphabet<I> alphabet)
Computes whether the language of the given DFA is prefix-closed.
|
static <S,I,A extends DFA<S,I> & InputAlphabetHolder<I>> |
minimize(A dfa)
Minimizes the given DFA.
|
static <I> CompactDFA<I> |
minimize(DFA<?,I> dfa,
Alphabet<I> alphabet)
Minimizes the given DFA over the given alphabet.
|
static <I> CompactDFA<I> |
or(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet)
Calculates the disjunction ("or") of two DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
or(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out)
Calculates the disjunction ("or") of two DFA, and stores the result in a given mutable DFA.
|
static <I> CompactDFA<I> |
xor(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Alphabet<I> inputAlphabet)
Calculates the exclusive-or ("xor") of two DFA, and returns the result as a new DFA.
|
static <I,S,A extends MutableDFA<S,I>> |
xor(DFA<?,I> dfa1,
DFA<?,I> dfa2,
Collection<? extends I> inputs,
A out)
Calculates the exclusive-or ("xor") of two DFA, and stores the result in a given mutable DFA.
|
public static <I> CompactDFA<I> combine(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet, AcceptanceCombiner combiner)
combine(DFA, DFA,
Collection, MutableDFA, AcceptanceCombiner)
, but the result automaton is automatically created as a CompactDFA
.dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetcombiner
- combination method for acceptance valuespublic static <I,S,A extends MutableDFA<S,I>> A combine(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out, AcceptanceCombiner combiner)
AcceptanceCombiner
specified via the combiner
parameter specifies how acceptance values of the DFAs will be combined to an acceptance value in the result DFA.dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- the mutable DFA for storing the resultcombiner
- combination method for acceptance valuesout
, for conveniencepublic static <I> CompactDFA<I> and(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet)
dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A and(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out)
dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> or(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet)
dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A or(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out)
dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> xor(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet)
dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A xor(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out)
dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> equiv(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet)
dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A equiv(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out)
dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> impl(DFA<?,I> dfa1, DFA<?,I> dfa2, Alphabet<I> inputAlphabet)
dfa1
- the first DFAdfa2
- the second DFAinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A impl(DFA<?,I> dfa1, DFA<?,I> dfa2, Collection<? extends I> inputs, A out)
dfa1
- the first DFAdfa2
- the second DFAinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> complement(DFA<?,I> dfa, Alphabet<I> inputAlphabet)
Note that unlike MutableFSA.flipAcceptance()
, undefined transitions are treated as leading to a rejecting
sink state (and are thus turned into an accepting sink).
dfa
- the DFA to complementinputAlphabet
- the input alphabetpublic static <I,S,A extends MutableDFA<S,I>> A complement(DFA<?,I> dfa, Collection<? extends I> inputs, A out)
Note that unlike MutableFSA.flipAcceptance()
, undefined transitions are treated as leading to a rejecting
sink state (and are thus turned into an accepting sink).
dfa
- the DFA to complementinputs
- the input symbols to considerout
- a mutable DFA for storing the resultout
, for conveniencepublic static <I> CompactDFA<I> complete(DFA<?,I> dfa, Alphabet<I> inputs)
public static <I,S,A extends MutableDFA<S,I>> A complete(DFA<?,I> dfa, Collection<? extends I> inputs, A out)
public static <I> CompactDFA<I> minimize(DFA<?,I> dfa, Alphabet<I> alphabet)
Note: the DFA must be completely specified.
dfa
- the DFA to be minimizedalphabet
- the input alphabet to consider for minimization (this will also be the input alphabet of the resulting
automaton)public static <S,I,A extends DFA<S,I> & InputAlphabetHolder<I>> CompactDFA<I> minimize(A dfa)
Note: the DFA must be completely specified
dfa
- the DFA to be minimizedpublic static <S,I> boolean isPrefixClosed(DFA<S,I> dfa, Alphabet<I> alphabet)
DFA
are reachable from the initial state.S
- the type of stateI
- the type of inputdfa
- the DFA to checkalphabet
- the Alphabetpublic static <S> boolean acceptsEmptyLanguage(DFA<S,?> dfa)
Copyright © 2020. All rights reserved.