java.lang.Object
net.automatalib.util.automaton.fsa.DFAs
Operations on
DFAs.
Note that the methods provided by this class do not modify their input arguments. Such methods are instead provided
by the MutableDFAs class. Furthermore, results are copied into new datastructures. For read-only views you
may use the more generic Acceptors factory.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S> booleanacceptsEmptyLanguage(DFA<S, ?> dfa) Computes whether the givenDFAaccepts the empty language.static <I,S, A extends MutableDFA<S, I>>
Aand(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the conjunction ("and") of two DFAs via product construction and stores the result in a given mutable DFA.static <I> CompactDFA<I>Calculates the conjunction ("and") of two DFAs via product construction and returns the result as a new DFA.static <I,S, A extends MutableDFA<S, I>>
Acombine(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out, AcceptanceCombiner combiner) Most general way of combining two DFAs via product construction.static <I> CompactDFA<I>combine(DFA<?, I> dfa1, DFA<?, I> dfa2, Alphabet<I> inputAlphabet, AcceptanceCombiner combiner) Most general way of combining two DFAs via product construction.static <I,S, A extends MutableDFA<S, I>>
Acomplement(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>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>>
Acomplete(DFA<?, I> dfa, Collection<? extends I> inputs, A out) static <I> CompactDFA<I>static <I,S, A extends MutableDFA<S, I>>
Aequiv(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the equivalence ("<=>") of two DFAs via product construction and stores the result in a given mutable DFA.static <I> CompactDFA<I>Calculates the equivalence ("<=>") of two DFAs via product construction and returns the result as a new DFA.static <I,S, A extends MutableDFA<S, I>>
Aimpl(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the implication ("=>") of two DFAs via product construction and stores the result in a given mutable DFA.static <I> CompactDFA<I>Calculates the implication ("=>") of two DFAs via product construction and returns the result as a new DFA.static <S,I> boolean isPrefixClosed(DFA<S, I> dfa, Collection<I> inputs) Computes whether the language of the given DFA is prefix-closed.static <I,S, A extends MutableDFA<S, I>>
Aor(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the disjunction ("or") of two DFAs via product construction and stores the result in a given mutable DFA.static <I> CompactDFA<I>Calculates the disjunction ("or") of two DFAs via product construction and returns the result as a new DFA.static <I> CompactDFA<I>Creates a trim DFA from the given input DFA.static <SI,I, SO, A extends MutableDFA<SO, I>>
Atrim(DFA<SI, I> dfa, Collection<? extends I> inputs, A out) Creates a trim DFA from the given input DFA and writes it to the given output DFA.static <I,S, A extends MutableDFA<S, I>>
Axor(DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the exclusive-or ("xor") of two DFAs via product construction and stores the result in a given mutable DFA.static <I> CompactDFA<I>Calculates the exclusive-or ("xor") of two DFAs via product construction and returns the result as a new DFA.
-
Method Details
-
combine
public static <I> CompactDFA<I> combine(DFA<?, I> dfa1, DFA<?, I> dfa2, Alphabet<I> inputAlphabet, AcceptanceCombiner combiner) Most general way of combining two DFAs via product construction. The behavior is the same as of the abovecombine(DFA, DFA, Collection, MutableDFA, AcceptanceCombiner), but the result automaton is automatically created as aCompactDFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabetcombiner- combination method for acceptance values- Returns:
- a new DFA representing the combination of the specified DFA
-
combine
public static <I,S, A combineA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out, AcceptanceCombiner combiner) Most general way of combining two DFAs via product construction. TheAcceptanceCombinerspecified via thecombinerparameter specifies how acceptance values of the DFAs will be combined to an acceptance value in the result DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- the mutable DFA for storing the resultcombiner- combination method for acceptance values- Returns:
out, for convenience
-
and
Calculates the conjunction ("and") of two DFAs via product construction and returns the result as a new DFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabet- Returns:
- a new DFA representing the conjunction of the specified DFA
-
and
public static <I,S, A andA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the conjunction ("and") of two DFAs via product construction and stores the result in a given mutable DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
or
Calculates the disjunction ("or") of two DFAs via product construction and returns the result as a new DFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabet- Returns:
- a new DFA representing the conjunction of the specified DFA
-
or
public static <I,S, A orA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the disjunction ("or") of two DFAs via product construction and stores the result in a given mutable DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
xor
Calculates the exclusive-or ("xor") of two DFAs via product construction and returns the result as a new DFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabet- Returns:
- a new DFA representing the conjunction of the specified DFA
-
xor
public static <I,S, A xorA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the exclusive-or ("xor") of two DFAs via product construction and stores the result in a given mutable DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
equiv
Calculates the equivalence ("<=>") of two DFAs via product construction and returns the result as a new DFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabet- Returns:
- a new DFA representing the conjunction of the specified DFA
-
equiv
public static <I,S, A equivA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the equivalence ("<=>") of two DFAs via product construction and stores the result in a given mutable DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
impl
Calculates the implication ("=>") of two DFAs via product construction and returns the result as a new DFA.- Type Parameters:
I- input symbol type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputAlphabet- the input alphabet- Returns:
- a new DFA representing the conjunction of the specified DFA
-
impl
public static <I,S, A implA extends MutableDFA<S, I>> (DFA<?, I> dfa1, DFA<?, I> dfa2, Collection<? extends I> inputs, A out) Calculates the implication ("=>") of two DFAs via product construction and stores the result in a given mutable DFA.- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa1- the first DFAdfa2- the second DFAinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
trim
Creates a trim DFA from the given input DFA. A DFA is trim if all of its states are accessible and co-accessible.- Type Parameters:
I- input symbol type- Parameters:
dfa- the input DFAinputAlphabet- the input alphabet- Returns:
- the trim DFA
- See Also:
-
trim
public static <SI,I, A trimSO, A extends MutableDFA<SO, I>> (DFA<SI, I> dfa, Collection<? extends I> inputs, A out) Creates a trim DFA from the given input DFA and writes it to the given output DFA. A DFA is trim if all of its states are accessible and co-accessible.- Type Parameters:
SI- (input) state typeI- input symbol typeSO- (output) state typeA- (output) automaton type- Parameters:
dfa- the input DFAinputs- the input symbols to considerout- the output NFA- Returns:
outfor convenience- See Also:
-
complement
Calculates the complement (negation) of a DFA and returns the result as a new DFA.Note that unlike
MutableFSA.flipAcceptance(), undefined transitions are treated as leading to a rejecting sink state (and are thus turned into an accepting sink).- Type Parameters:
I- input symbol type- Parameters:
dfa- the DFA to complementinputAlphabet- the input alphabet- Returns:
- a new DFA representing the complement of the specified DFA
-
complement
public static <I,S, A complementA extends MutableDFA<S, I>> (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.Note that unlike
MutableFSA.flipAcceptance(), undefined transitions are treated as leading to a rejecting sink state (and are thus turned into an accepting sink).- Type Parameters:
I- input symbol typeS- state typeA- automaton type- Parameters:
dfa- the DFA to complementinputs- the input symbols to considerout- a mutable DFA for storing the result- Returns:
out, for convenience
-
complete
-
complete
public static <I,S, A completeA extends MutableDFA<S, I>> (DFA<?, I> dfa, Collection<? extends I> inputs, A out) -
isPrefixClosed
Computes whether the language of the given DFA is prefix-closed.Assumes all states in the given
DFAare reachable from the initial state.- Type Parameters:
I- input symbol typeS- state type- Parameters:
dfa- the DFA to checkinputs- the input symbols to consider- Returns:
- whether the DFA is prefix-closed
-
acceptsEmptyLanguage
-