Class FilteredGenerator<E>

java.lang.Object
org.apache.commons.functor.generator.BaseGenerator<E>
org.apache.commons.functor.generator.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 Details

    • pred

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

    • FilteredGenerator

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

    • run

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

      protected Generator<? extends E> getWrappedGenerator()
      Get the generator that is being wrapped.
      Overrides:
      getWrappedGenerator in class BaseGenerator<E>
      Returns:
      Generator
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object