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 Summary
Fields Modifier and Type Field Description private UnaryPredicate<? super E>predThe wrapped generator.
-
Constructor Summary
Constructors Constructor Description FilteredGenerator(Generator<? extends E> wrapped, UnaryPredicate<? super E> pred)Create a new FilteredGenerator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)protected Generator<? extends E>getWrappedGenerator()Get the generator that is being wrapped.inthashCode()voidrun(UnaryProcedure<? super E> proc)Generators must implement this method.-
Methods inherited from class org.apache.commons.functor.generator.BaseGenerator
isStopped, stop, to, to, toCollection
-
-
-
-
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 wrappred- filtering UnaryPredicate
-
-
Method Detail
-
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:
getWrappedGeneratorin classBaseGenerator<E>- Returns:
- Generator
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-