public static <I, S, A extends MutableDFA<S, I>> A complement(DFA<?, I> dfa,
                                                                  Collection<? extends I> inputs,
                                                                  A out) {
        AutomatonLowLevelCopy.copy(AutomatonCopyMethod.STATE_BY_STATE,
                                   dfa,
                                   inputs,
                                   out,
                                   b -> (b == null) || !b,
                                   t -> null);
        MutableDFAs.complete(out, inputs, false, true);
        return out;
    }
public static < I , S , A extends MutableDFA < S , I > > A complement ( DFA < ? , I > dfa , Collection < ? extends I > inputs , A out ) { AutomatonLowLevelCopy . copy ( AutomatonCopyMethod . STATE_BY_STATE , dfa , inputs , out , b -> ( b == null ) || ! b , t -> null ) ; MutableDFAs . complete ( out , inputs , false , true ) ; return out ; }
Calculates the complement (negation) of a DFA, and stores the result in a given mutable DFA.
<p>
Note that unlike {@link MutableDFA#flipAcceptance()}, undefined transitions are treated as leading to a rejecting
sink state (and are thus turned into an accepting sink).

@param dfa
the DFA to complement
@param inputs
the input symbols to consider
@param out
a mutable DFA for storing the result

@return {@code out}, for convenience