Class TransformedGenerator<I,E>
- java.lang.Object
-
- org.apache.commons.functor.generator.BaseGenerator<E>
-
- org.apache.commons.functor.generator.TransformedGenerator<I,E>
-
- Type Parameters:
I- the type of elements held in the wrapped generator.E- the type of elements held in this generator.
- All Implemented Interfaces:
Generator<E>
public class TransformedGenerator<I,E> extends BaseGenerator<E>
Generator that transforms the elements of another Generator.- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description private UnaryFunction<? super I,? extends E>funcThe UnaryFunction to apply to each element.
-
Constructor Summary
Constructors Constructor Description TransformedGenerator(Generator<? extends I> wrapped, UnaryFunction<? super I,? extends E> func)Create a new TransformedGenerator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)protected Generator<? extends I>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
-
func
private final UnaryFunction<? super I,? extends E> func
The UnaryFunction to apply to each element.
-
-
Constructor Detail
-
TransformedGenerator
public TransformedGenerator(Generator<? extends I> wrapped, UnaryFunction<? super I,? extends E> func)
Create a new TransformedGenerator.- Parameters:
wrapped- Generator to transformfunc- UnaryFunction to apply to each element
-
-
Method Detail
-
run
public void run(UnaryProcedure<? super E> proc)
Generators must implement this method.- Parameters:
proc- UnaryProcedure to run
-
getWrappedGenerator
protected Generator<? extends I> 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
-
-