Class WhileGenerate<E>
- java.lang.Object
-
- org.apache.commons.functor.generator.BaseGenerator<E>
-
- org.apache.commons.functor.generator.WhileGenerate<E>
-
- Type Parameters:
E- the type of elements held in this generator.
- All Implemented Interfaces:
Generator<E>
public class WhileGenerate<E> extends BaseGenerator<E>
Wrap anotherGeneratorsuch thatrun(UnaryProcedure)continues as long as a condition is true (test before).- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description private UnaryPredicate<? super E>testThe condition has to verified in order to execute the generation.
-
Constructor Summary
Constructors Constructor Description WhileGenerate(UnaryPredicate<? super E> test, Generator<? extends E> wrapped)Create a new WhileGenerate.
-
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
-
test
private final UnaryPredicate<? super E> test
The condition has to verified in order to execute the generation.
-
-
Constructor Detail
-
WhileGenerate
public WhileGenerate(UnaryPredicate<? super E> test, Generator<? extends E> wrapped)
Create a new WhileGenerate.- Parameters:
test-UnaryPredicatewrapped-Generator
-
-
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
-
-