org.apache.commons.collections.functors
public class WhileClosure extends Object implements Closure, Serializable
Since: Commons Collections 3.0
Version: $Revision: 348444 $ $Date: 2005-11-23 14:06:56 +0000 (Wed, 23 Nov 2005) $
Constructor Summary | |
---|---|
WhileClosure(Predicate predicate, Closure closure, boolean doLoop)
Constructor that performs no validation.
|
Method Summary | |
---|---|
void | execute(Object input)
Executes the closure until the predicate is false.
|
Closure | getClosure()
Gets the closure.
|
static Closure | getInstance(Predicate predicate, Closure closure, boolean doLoop)
Factory method that performs validation.
|
Predicate | getPredicate()
Gets the predicate in use.
|
boolean | isDoLoop()
Is the loop a do-while loop.
|
getInstance
if you want that.
Parameters: predicate the predicate used to evaluate when the loop terminates, not null closure the closure the execute, not null doLoop true to act as a do-while loop, always executing the closure once
Parameters: input the input object
Returns: the closure
Since: Commons Collections 3.1
Parameters: predicate the predicate used to evaluate when the loop terminates, not null closure the closure the execute, not null doLoop true to act as a do-while loop, always executing the closure once
Returns: the while
closure
Throws: IllegalArgumentException if the predicate or closure is null
Returns: the predicate
Since: Commons Collections 3.1
Returns: true is do-while, false if while
Since: Commons Collections 3.1