| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.functor.generator.BaseGenerator<E>
public abstract class BaseGenerator<E>
Base class for generators. Adds support for all of the Algorithms to
 each subclass.
| Constructor Summary | |
|---|---|
| BaseGenerator()Create a new generator. | |
| BaseGenerator(Generator<?> generator)A generator can wrap another generator. | |
| Method Summary | ||
|---|---|---|
| protected  Generator<?> | getWrappedGenerator()Get the generator that is being wrapped. | |
|  boolean | isStopped()Check if the generator is stopped. | |
|  void | stop()Stop the generator. | |
|  Collection<? super E> | to(Collection<? super E> collection)Same as to(new CollectionTransformer(collection)). | |
| 
 | to(UnaryFunction<Generator<? extends E>,? extends T> transformer)Transforms this generator using the passed in transformer. | |
|  Collection<E> | toCollection()Same as to(new CollectionTransformer()). | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.commons.functor.generator.Generator | 
|---|
| run | 
| Constructor Detail | 
|---|
public BaseGenerator()
public BaseGenerator(Generator<?> generator)
stop() method to stop the wrapped generator as well.
generator - Generator to wrap| Method Detail | 
|---|
protected Generator<?> getWrappedGenerator()
public void stop()
stop in interface Generator<E>public boolean isStopped()
isStopped in interface Generator<E>public final <T> T to(UnaryFunction<Generator<? extends E>,? extends T> transformer)
Collection of elements.
 Transforms this generator using the passed in
 UnaryFunction. An example function might turn the contents of the
 generator into a Collection of elements.
to in interface Generator<E>T - the returned value type of the input UnaryFunction.transformer - UnaryFunction to apply to this
public final Collection<? super E> to(Collection<? super E> collection)
to in interface Generator<E>collection - Collection to which my elements should be added
collectionpublic final Collection<E> toCollection()
toCollection in interface Generator<E>| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||