A - the argument type.public final class ConditionalUnaryProcedure<A> extends Object implements UnaryProcedure<A>, Serializable
UnaryProcedure
similiar to Java's "ternary"
or "conditional" operator (? :).
Given a predicate
p and procedures
q and r, runs
if (p.test(x)) { q.run(x); } else { r.run(x); }.
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 |
|---|
ConditionalUnaryProcedure(UnaryPredicate<? super A> ifPred,
UnaryProcedure<? super A> thenProc)
Create a new ConditionalUnaryProcedure.
|
ConditionalUnaryProcedure(UnaryPredicate<? super A> ifPred,
UnaryProcedure<? super A> thenProc,
UnaryProcedure<? super A> elseProc)
Create a new ConditionalUnaryProcedure.
|
public ConditionalUnaryProcedure(UnaryPredicate<? super A> ifPred, UnaryProcedure<? super A> thenProc)
ifPred - ifthenProc - thenpublic ConditionalUnaryProcedure(UnaryPredicate<? super A> ifPred, UnaryProcedure<? super A> thenProc, UnaryProcedure<? super A> elseProc)
ifPred - ifthenProc - thenelseProc - elsepublic void run(A obj)
run in interface UnaryProcedure<A>obj - an A parameter to this executionpublic boolean equals(ConditionalUnaryProcedure<?> that)
that - ConditionalUnaryProcedure to testCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.