Class NFAs


  • public final class NFAs
    extends Object
    Operations on NFAs.

    Note that the methods provided by this class do not modify their input arguments. Furthermore, results are copied into new datastructures. For read-only views you may use the more generic Acceptors factory.

    • Method Detail

      • combine

        public static <I> CompactNFA<I> combine​(NFA<?,​I> nfa1,
                                                NFA<?,​I> nfa2,
                                                Alphabet<I> inputAlphabet,
                                                AcceptanceCombiner combiner)
        Most general way of combining two NFAs. The behavior is the same as of the above combine(NFA, NFA, Collection, MutableNFA, AcceptanceCombiner), but the result automaton is automatically created as a CompactNFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        combiner - combination method for acceptance values
        Returns:
        a new NFA representing the combination of the specified NFAs
      • combine

        public static <I,​S,​A extends MutableNFA<S,​I>> A combine​(NFA<?,​I> nfa1,
                                                                                  NFA<?,​I> nfa2,
                                                                                  Collection<? extends I> inputs,
                                                                                  A out,
                                                                                  AcceptanceCombiner combiner)
        Most general way of combining two NFAs. The AcceptanceCombiner specified via the combiner parameter specifies how acceptance values of the NFAs will be combined to an acceptance value in the result NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - the mutable NFA for storing the result
        combiner - combination method for acceptance values
        Returns:
        out, for convenience
      • and

        public static <I> CompactNFA<I> and​(NFA<?,​I> nfa1,
                                            NFA<?,​I> nfa2,
                                            Alphabet<I> inputAlphabet)
        Calculates the conjunction ("and") of two NFAs, and returns the result as a new NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        Returns:
        a new NFA representing the conjunction of the specified NFA
      • and

        public static <I,​S,​A extends MutableNFA<S,​I>> A and​(NFA<?,​I> nfa1,
                                                                              NFA<?,​I> nfa2,
                                                                              Collection<? extends I> inputs,
                                                                              A out)
        Calculates the conjunction ("and") of two NFAs, and stores the result in a given mutable NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - a mutable NFA for storing the result
        Returns:
        out, for convenience
      • or

        public static <I> CompactNFA<I> or​(NFA<?,​I> nfa1,
                                           NFA<?,​I> nfa2,
                                           Alphabet<I> inputAlphabet)
        Calculates the disjunction ("or") of two NFAs, and returns the result as a new NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        Returns:
        a new NFA representing the conjunction of the specified NFA
      • or

        public static <I,​S,​A extends MutableNFA<S,​I>> A or​(NFA<?,​I> nfa1,
                                                                             NFA<?,​I> nfa2,
                                                                             Collection<? extends I> inputs,
                                                                             A out)
        Calculates the disjunction ("or") of two NFAs, and stores the result in a given mutable NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - a mutable NFA for storing the result
        Returns:
        out, for convenience
      • xor

        public static <I> CompactNFA<I> xor​(NFA<?,​I> nfa1,
                                            NFA<?,​I> nfa2,
                                            Alphabet<I> inputAlphabet)
        Calculates the exclusive-or ("xor") of two NFAs, and returns the result as a new NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        Returns:
        a new NFA representing the conjunction of the specified NFA
      • xor

        public static <I,​S,​A extends MutableNFA<S,​I>> A xor​(NFA<?,​I> nfa1,
                                                                              NFA<?,​I> nfa2,
                                                                              Collection<? extends I> inputs,
                                                                              A out)
        Calculates the exclusive-or ("xor") of two NFAs, and stores the result in a given mutable NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - a mutable NFA for storing the result
        Returns:
        out, for convenience
      • equiv

        public static <I> CompactNFA<I> equiv​(NFA<?,​I> nfa1,
                                              NFA<?,​I> nfa2,
                                              Alphabet<I> inputAlphabet)
        Calculates the equivalence ("<=>") of two NFAs, and returns the result as a new NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        Returns:
        a new NFA representing the conjunction of the specified NFA
      • equiv

        public static <I,​S,​A extends MutableNFA<S,​I>> A equiv​(NFA<?,​I> nfa1,
                                                                                NFA<?,​I> nfa2,
                                                                                Collection<? extends I> inputs,
                                                                                A out)
        Calculates the equivalence ("<=>") of two NFAs, and stores the result in a given mutable NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - a mutable NFA for storing the result
        Returns:
        out, for convenience
      • impl

        public static <I> CompactNFA<I> impl​(NFA<?,​I> nfa1,
                                             NFA<?,​I> nfa2,
                                             Alphabet<I> inputAlphabet)
        Calculates the implication ("=>") of two NFAs, and returns the result as a new NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputAlphabet - the input alphabet
        Returns:
        a new NFA representing the conjunction of the specified NFA
      • impl

        public static <I,​S,​A extends MutableNFA<S,​I>> A impl​(NFA<?,​I> nfa1,
                                                                               NFA<?,​I> nfa2,
                                                                               Collection<? extends I> inputs,
                                                                               A out)
        Calculates the implication ("=>") of two NFAs, and stores the result in a given mutable NFA.
        Parameters:
        nfa1 - the first NFA
        nfa2 - the second NFA
        inputs - the input symbols to consider
        out - a mutable NFA for storing the result
        Returns:
        out, for convenience
      • determinize

        public static <I> CompactDFA<I> determinize​(NFA<?,​I> nfa,
                                                    Alphabet<I> inputAlphabet)
      • determinize

        public static <I> CompactDFA<I> determinize​(NFA<?,​I> nfa,
                                                    Alphabet<I> inputAlphabet,
                                                    boolean partial,
                                                    boolean minimize)
      • determinize

        public static <I> void determinize​(NFA<?,​I> nfa,
                                           Collection<? extends I> inputs,
                                           MutableDFA<?,​I> out,
                                           boolean partial,
                                           boolean minimize)
      • determinize

        public static <I> void determinize​(NFA<?,​I> nfa,
                                           Collection<? extends I> inputs,
                                           MutableDFA<?,​I> out)