Class MealyFilter


  • public final class MealyFilter
    extends Object
    Various utility methods to filter Mealy machines.
    • Method Detail

      • pruneTransitionsWithOutput

        @SafeVarargs
        public static <I,​O> CompactMealy<I,​O> pruneTransitionsWithOutput​(MealyMachine<?,​I,​?,​O> in,
                                                                                     Alphabet<I> inputs,
                                                                                     O... outputs)
        Returns a Mealy machine with all transitions removed that have one of the specified output values. The resulting Mealy machine will not contain any unreachable states.

        This is a convenience varargs overload of pruneTransitionsWithOutput(MealyMachine, Alphabet, Collection).

        Parameters:
        in - the input Mealy machine
        inputs - the input alphabet
        outputs - the outputs to remove
        Returns:
        a Mealy machine with all transitions removed that have one of the specified outputs.
      • pruneTransitionsWithOutput

        public static <I,​O> CompactMealy<I,​O> pruneTransitionsWithOutput​(MealyMachine<?,​I,​?,​O> in,
                                                                                     Alphabet<I> inputs,
                                                                                     Collection<? super O> outputs)
        Returns a Mealy machine with all transitions removed that have one of the specified output values. The resulting Mealy machine will not contain any unreachable states.
        Parameters:
        in - the input Mealy machine
        inputs - the input alphabet
        outputs - the outputs to remove
        Returns:
        a Mealy machine with all transitions removed that have one of the specified outputs.
      • retainTransitionsWithOutput

        @SafeVarargs
        public static <I,​O> CompactMealy<I,​O> retainTransitionsWithOutput​(MealyMachine<?,​I,​?,​O> in,
                                                                                      Alphabet<I> inputs,
                                                                                      O... outputs)
        Returns a Mealy machine with all transitions removed that have an output not among the specified values. The resulting Mealy machine will not contain any unreachable states.

        This is a convenience varargs overload of retainTransitionsWithOutput(MealyMachine, Alphabet, Collection).

        Parameters:
        in - the input Mealy machine
        inputs - the input alphabet
        outputs - the outputs to retain
        Returns:
        a Mealy machine with all transitions retained that have one of the specified outputs.
      • retainTransitionsWithOutput

        public static <I,​O> CompactMealy<I,​O> retainTransitionsWithOutput​(MealyMachine<?,​I,​?,​O> in,
                                                                                      Alphabet<I> inputs,
                                                                                      Collection<? super O> outputs)
        Returns a Mealy machine with all transitions removed that have an output not among the specified values. The resulting Mealy machine will not contain any unreachable states.
        Parameters:
        in - the input Mealy machine
        inputs - the input alphabet
        outputs - the outputs to retain
        Returns:
        a Mealy machine with all transitions retained that have one of the specified outputs.