org.apache.commons.functor.generator
Class UntilGenerate<E>

java.lang.Object
  extended by org.apache.commons.functor.generator.BaseGenerator<E>
      extended by org.apache.commons.functor.generator.UntilGenerate<E>
All Implemented Interfaces:
Generator<E>

public class UntilGenerate<E>
extends BaseGenerator<E>

Wrap another Generator such that run(UnaryProcedure) terminates once a condition has been satisfied.

Version:
$Revision: 1156801 $ $Date: 2011-08-11 22:12:44 +0200 (Thu, 11 Aug 2011) $

Constructor Summary
UntilGenerate(UnaryPredicate<? super E> test, Generator<? extends E> wrapped)
          Create a new UntilGenerate.
 
Method Summary
 boolean equals(Object obj)
          
protected  Generator<? extends E> getWrappedGenerator()
          Get the generator that is being wrapped.
 int hashCode()
          
 void run(UnaryProcedure<? super E> proc)
          Generators must implement this method.
 
Methods inherited from class org.apache.commons.functor.generator.BaseGenerator
isStopped, stop, to, to, toCollection
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UntilGenerate

public UntilGenerate(UnaryPredicate<? super E> test,
                     Generator<? extends E> wrapped)
Create a new UntilGenerate.

Parameters:
wrapped - Generator
test - 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:
getWrappedGenerator in class BaseGenerator<E>
Returns:
Generator

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.