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>
Wrap another
Generator such that run(UnaryProcedure) continues
as long as a condition is true (test after).- Version:
- $Revision$ $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UnaryPredicate<? super E> The condition has to verified in order to execute the generation. -
Constructor Summary
ConstructorsConstructorDescriptionGenerateWhile(Generator<? extends E> wrapped, UnaryPredicate<? super E> test) Create a new GenerateWhile. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the generator that is being wrapped.inthashCode()voidrun(UnaryProcedure<? super E> proc) Generators must implement this method.Methods inherited from class BaseGenerator
isStopped, stop, to, to, toCollection
-
Field Details
-
test
The condition has to verified in order to execute the generation.
-
-
Constructor Details
-
GenerateWhile
Create a new GenerateWhile.- Parameters:
wrapped-Generatortest-UnaryPredicate
-
-
Method Details
-
run
Generators must implement this method.- Parameters:
proc- UnaryProcedure to run
-
getWrappedGenerator
Get the generator that is being wrapped.- Overrides:
getWrappedGeneratorin classBaseGenerator<E>- Returns:
- Generator
-
equals
-
hashCode
-