Class GenerateUntil<E>
- java.lang.Object
-
- org.apache.commons.functor.generator.BaseGenerator<E>
-
- org.apache.commons.functor.generator.GenerateUntil<E>
-
- Type Parameters:
E- the type of elements held in this generator.
- All Implemented Interfaces:
Generator<E>
public class GenerateUntil<E> extends BaseGenerator<E>
Wrap anotherGeneratorsuch thatrun(UnaryProcedure)terminates once a condition has been satisfied (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 GenerateUntil(Generator<? extends E> wrapped, UnaryPredicate<? super E> test)Create a new GenerateUntil.
-
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
-
GenerateUntil
public GenerateUntil(Generator<? extends E> wrapped, UnaryPredicate<? super E> test)
Create a new GenerateUntil.- 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
-
-