| net.sf.jga.fn.adaptor.ConditionalBinary
All known Subclasses: net.sf.jga.fn.AdaptorVisitor,
ConditionalBinary | public class ConditionalBinary extends BinaryFunctor (Code) | | BinaryFunctor that tests a condition, executes one of two given functors, and
returns the result. The arguments used to evaluate the condition will also
be passed to whichever functor is executed. This functor implements the
traditional ?: operator.
Copyright © 2003-2005 David A. Hall
author: David A. Hall |
Constructor Summary | |
public | ConditionalBinary(BinaryFunctor<T1, T2, Boolean> test, BinaryFunctor<T1, T2, R> trueFn, BinaryFunctor<T1, T2, R> falseFn) Builds a ConditionalBinary functor, given the condition to test, and the two
functors that may be executed. |
Method Summary | |
public void | accept(net.sf.jga.fn.Visitor v) Calls the Visitor's visit(ConditionalBinary) method, if it
implements the nested Visitor interface. | public R | fn(T1 x, T2 y) Given arguments x and x evaluates test(x,y); if true,
returns trueFn(x,y), otherwise, returns falseFn(x,y). | public BinaryFunctor<T1, T2, Boolean> | getCondition() | public BinaryFunctor<T1, T2, R> | getFalseFunctor() | public BinaryFunctor<T1, T2, R> | getTrueFunctor() | public String | toString() |
serialVersionUID | final static long serialVersionUID(Code) | | |
ConditionalBinary | public ConditionalBinary(BinaryFunctor<T1, T2, Boolean> test, BinaryFunctor<T1, T2, R> trueFn, BinaryFunctor<T1, T2, R> falseFn)(Code) | | Builds a ConditionalBinary functor, given the condition to test, and the two
functors that may be executed.
throws: IllegalArgumentException - if any of the functors is missing |
accept | public void accept(net.sf.jga.fn.Visitor v)(Code) | | Calls the Visitor's visit(ConditionalBinary) method, if it
implements the nested Visitor interface.
|
fn | public R fn(T1 x, T2 y)(Code) | | Given arguments x and x evaluates test(x,y); if true,
returns trueFn(x,y), otherwise, returns falseFn(x,y).
test(x,y) ? trueFn(x,y) : falseFn(x,y) |
getFalseFunctor | public BinaryFunctor<T1, T2, R> getFalseFunctor()(Code) | | Returns the functor that is executed when the condition is false
the functor that is executed when the condition is false |
getTrueFunctor | public BinaryFunctor<T1, T2, R> getTrueFunctor()(Code) | | Returns the functor that is executed when the condition is true
the functor that is executed when the condition is true |
|
|