| net.sf.jga.fn.adaptor.ComposeUnary
All known Subclasses: net.sf.jga.fn.AdaptorVisitor,
ComposeUnary | public class ComposeUnary extends UnaryFunctor (Code) | | Unary Functor that passes the results of two Unary Functors as the arguments
to a Binary Functor. This allows for the construction of compound functors
from the primitives found in the arithmetic, logical, property, and
comparison packages.
For example: LogicalAnd is of limited utility since it takes only Boolean
arguments. To use LogicalAnd for something a little more interesting
(eg, is the given integer between 1 and 10), combine LogicalAnd with
GreaterEqual and LessEqual using Binary Compose and Bind1st as follows:
new ComposeUnary<Integer,Boolean,Boolean,Boolean> (
new Bind1st<Integer,Integer,Boolean> (1, new LessEqual<Integer>()),
new Bind1st<Integer,Integer,Boolean> (10, new GreaterEqual<Integer>()),
new LogicalAnd());
While it may not be the most readable construction in the world, it does
become easier over time.
Copyright © 2002-2005 David A. Hall
author: David A. Hall |
serialVersionUID | final static long serialVersionUID(Code) | | |
accept | public void accept(net.sf.jga.fn.Visitor v)(Code) | | Calls the Visitor's visit(ComposeUnary) method, if it
implements the nested Visitor interface.
|
fn | public R fn(T x)(Code) | | Given argument x, passes x to both inner functors, and passes the
results of those functors to the outer functor.
h(f(x), g(x)) |
getFirstInnerFunctor | public UnaryFunctor<T, F1> getFirstInnerFunctor()(Code) | | Returns the first of two inner functors
the first of two inner functors |
getOuterFunctor | public BinaryFunctor<F1, F2, R> getOuterFunctor()(Code) | | Returns the outer functor
the outer functor |
getSecondInnerFunctor | public UnaryFunctor<T, F2> getSecondInnerFunctor()(Code) | | Returns the second of two inner functors
the second of two inner functors |
|
|