L - the left argument type.R - the right argument type.public final class ConditionalBinaryProcedure<L,R> extends Object implements BinaryProcedure<L,R>, Serializable
BinaryProcedure
similiar to Java's "ternary"
or "conditional" operator (? :).
Given a predicate
p and procedures
q and r, runs
if (p.test(x,y)) { q.run(x,y); } else { r.run(x,y); }.
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 |
|---|
ConditionalBinaryProcedure(BinaryPredicate<? super L,? super R> ifPred,
BinaryProcedure<? super L,? super R> thenProc)
Create a new ConditionalBinaryProcedure.
|
ConditionalBinaryProcedure(BinaryPredicate<? super L,? super R> ifPred,
BinaryProcedure<? super L,? super R> thenProc,
BinaryProcedure<? super L,? super R> elseProc)
Create a new ConditionalBinaryProcedure.
|
public ConditionalBinaryProcedure(BinaryPredicate<? super L,? super R> ifPred, BinaryProcedure<? super L,? super R> thenProc)
ifPred - to evaluatethenProc - if ifPred yields truepublic ConditionalBinaryProcedure(BinaryPredicate<? super L,? super R> ifPred, BinaryProcedure<? super L,? super R> thenProc, BinaryProcedure<? super L,? super R> elseProc)
ifPred - to evaluatethenProc - if ifPred yields trueelseProc - if ifPred yields falsepublic void run(L left, R right)
run in interface BinaryProcedure<L,R>left - the L element of the ordered pair of argumentsright - the R element of the ordered pair of argumentspublic boolean equals(ConditionalBinaryProcedure<?,?> that)
that - compared objectCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.