public final class ConditionalProcedure extends Object implements Procedure, Serializable
Procedure
similiar to Java's "ternary"
or "conditional" operator (? :).
Given a predicate
p and procedures
q and r, runs
if (p.test()) { q.run(); } else { r.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.
| Constructor and Description |
|---|
ConditionalProcedure(Predicate ifPred,
Procedure thenProc)
Create a new ConditionalProcedure.
|
ConditionalProcedure(Predicate ifPred,
Procedure thenProc,
Procedure elseProc)
Create a new ConditionalProcedure.
|
public ConditionalProcedure(Predicate ifPred, Procedure thenProc)
ifPred - ifthenProc - thenpublic ConditionalProcedure(Predicate ifPred, Procedure thenProc, Procedure elseProc)
ifPred - ifthenProc - thenelseProc - elsepublic void run()
public boolean equals(ConditionalProcedure that)
that - the ConditionalProcedure to testCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.