Class FilteredGenerator<E>

  • Type Parameters:
    E - the type of elements held in this generator.
    All Implemented Interfaces:
    Generator<E>

    public class FilteredGenerator<E>
    extends BaseGenerator<E>
    Generator that filters another Generator by only passing through those elements that are matched by a specified UnaryPredicate.
    Version:
    $Revision$ $Date$
    • Field Detail

      • pred

        private final UnaryPredicate<? super E> pred
        The wrapped generator.
    • Constructor Detail

      • FilteredGenerator

        public FilteredGenerator​(Generator<? extends E> wrapped,
                                 UnaryPredicate<? super E> pred)
        Create a new FilteredGenerator.
        Parameters:
        wrapped - Generator to wrap
        pred - filtering UnaryPredicate
    • Method Detail

      • run

        public void run​(UnaryProcedure<? super E> proc)
        Generators must implement this method.
        Parameters:
        proc - UnaryProcedure to run
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object