org.apache.commons.collections.functors
public class WhileClosure extends Object implements Closure, Serializable
Since: Commons Collections 3.0
Version: $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
| 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