org.apache.commons.functor.core.composite
Class WhileDoProcedure

java.lang.Object
  extended by org.apache.commons.functor.core.composite.AbstractLoopProcedure
      extended by org.apache.commons.functor.core.composite.WhileDoProcedure
All Implemented Interfaces:
Serializable, Runnable, Functor, NullaryFunctor, Procedure

public class WhileDoProcedure
extends AbstractLoopProcedure

A Procedure implementation of a while loop. Given a Predicate c and an Procedure p, runs while(c.test()) { p.run(); }.

Note that although this class implements Serializable, a given instance will only be truly Serializable if all the underlying functors are. Attempts to serialize an instance whose delegates are not all Serializable will result in an exception.

Version:
$Revision: 1156320 $ $Date: 2011-08-10 21:14:50 +0200 (Wed, 10 Aug 2011) $
Author:
Herve Quiroz, Rodney Waldhoff
See Also:
Serialized Form

Constructor Summary
WhileDoProcedure(Predicate condition, Procedure action)
          Create a new WhileDoProcedure.
 
Method Summary
 void run()
          Execute this procedure.
 String toString()
          Returns a human readable description of this functor.
 
Methods inherited from class org.apache.commons.functor.core.composite.AbstractLoopProcedure
equals, getAction, getCondition, hashCode, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WhileDoProcedure

public WhileDoProcedure(Predicate condition,
                        Procedure action)
Create a new WhileDoProcedure.

Parameters:
condition - while
action - to do
Method Detail

run

public void run()
Execute this procedure.


toString

public String toString()
Returns a human readable description of this functor. Implementators are strongly encouraged but not strictly required to override the default Object implementation of this method.

Specified by:
toString in interface Functor
Overrides:
toString in class AbstractLoopProcedure
Returns:
a human readable description of this functor


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