Class GenerateWhile<E>
- java.lang.Object
-
- org.apache.commons.functor.generator.BaseGenerator<E>
-
- org.apache.commons.functor.generator.GenerateWhile<E>
-
- Type Parameters:
E- the type of elements held in this generator.
- All Implemented Interfaces:
Generator<E>
public class GenerateWhile<E> extends BaseGenerator<E>
Wrap anotherGeneratorsuch thatrun(UnaryProcedure)continues as long as a condition is true (test after).- 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 GenerateWhile(Generator<? extends E> wrapped, UnaryPredicate<? super E> test)Create a new GenerateWhile.
-
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
-
GenerateWhile
public GenerateWhile(Generator<? extends E> wrapped, UnaryPredicate<? super E> test)
Create a new GenerateWhile.- Parameters:
wrapped-Generatortest-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
-
-