|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections.functors.WhileClosure
public class WhileClosure
Closure implementation that executes a closure repeatedly until a condition is met, like a do-while or while loop.
| Constructor Summary | |
|---|---|
WhileClosure(Predicate predicate,
Closure closure,
boolean doLoop)
Constructor that performs no validation. |
|
| Method Summary | |
|---|---|
void |
execute(java.lang.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WhileClosure(Predicate predicate,
Closure closure,
boolean doLoop)
getInstance if you want that.
predicate - the predicate used to evaluate when the loop terminates, not nullclosure - the closure the execute, not nulldoLoop - true to act as a do-while loop, always executing the closure once| Method Detail |
|---|
public static Closure getInstance(Predicate predicate,
Closure closure,
boolean doLoop)
predicate - the predicate used to evaluate when the loop terminates, not nullclosure - the closure the execute, not nulldoLoop - true to act as a do-while loop, always executing the closure once
while closure
java.lang.IllegalArgumentException - if the predicate or closure is nullpublic void execute(java.lang.Object input)
execute in interface Closureinput - the input objectpublic Predicate getPredicate()
public Closure getClosure()
public boolean isDoLoop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||