| net.sf.jga.fn.BinaryFunctor
BinaryFunctor | abstract public class BinaryFunctor extends Functor implements Serializable,Visitable(Code) | | A Function Object that takes two arguments and returns a result. The two
arguments are of type T1 and T2 , and
the result is of type R
Copyright © 2002-2005 David A. Hall
author: David A. Hall |
Method Summary | |
public void | accept(Visitor v) No-op implementation of Visitable interface. | public Generator<R> | bind(T1 value1, T2 value2) Factory method that creates a Generator that binds constant values to
this' arguments. | public UnaryFunctor<T2, R> | bind1st(T1 value) Factory method that creates a UnaryFunctor that binds a constant value to
this' first argument. | public UnaryFunctor<T1, R> | bind2nd(T2 value) Factory method that creates a UnaryFunctor that binds a constant value to
this' second argument. | public UnaryFunctor<F, R> | compose(UnaryFunctor<F, T1> g, UnaryFunctor<F, T2> h) FactoryMethod that creates a UnaryFunctor that passes its argument to
each of the given functors, and uses the results as the arguments to this
function. | public BinaryFunctor<F1, F2, R> | compose(BinaryFunctor<F1, F2, T1> g, BinaryFunctor<F1, F2, T2> h) FactoryMethod that creates a BinaryFunctor that passes its argument to
each of the given functors, and uses the results as the arguments to this
function. | public BinaryFunctor<F1, F2, R> | distribute(UnaryFunctor<F1, T1> g, UnaryFunctor<F2, T2> h) FactoryMethod that creates a BinaryFunctor that passes each of its two
arguments to a pair of UnaryFunctors, then uses the results as arguments
to this function. | public R | eval(Object... args) | abstract public R | fn(T1 arg1, T2 arg2) Executes the function and returns the result. | public Generator<R> | generate(Generator<T1> gen1, Generator<T2> gen2) FactoryMethod that converts this functor to a Generator by using the two
given generators to produce the arguments. | public UnaryFunctor<T2, R> | generate1st(Generator<T1> gen) FactoryMethod that converts this functor to a UnaryFunctor by using the
given generator to produce the first argument. | public UnaryFunctor<T1, R> | generate2nd(Generator<T2> gen) FactoryMethod that converts this functor to a UnaryFunctor by using the
given generator to produce the first argument. |
accept | public void accept(Visitor v)(Code) | | No-op implementation of Visitable interface.
|
bind | public Generator<R> bind(T1 value1, T2 value2)(Code) | | Factory method that creates a Generator that binds constant values to
this' arguments. The new generator will return
fnthis(value1, value2)
|
bind1st | public UnaryFunctor<T2, R> bind1st(T1 value)(Code) | | Factory method that creates a UnaryFunctor that binds a constant value to
this' first argument. Given argument x, the new functor will
return fnthis(value, x)
|
bind2nd | public UnaryFunctor<T1, R> bind2nd(T2 value)(Code) | | Factory method that creates a UnaryFunctor that binds a constant value to
this' second argument. Given argument x, the new functor will
return fnthis(x, value)
|
compose | public UnaryFunctor<F, R> compose(UnaryFunctor<F, T1> g, UnaryFunctor<F, T2> h)(Code) | | FactoryMethod that creates a UnaryFunctor that passes its argument to
each of the given functors, and uses the results as the arguments to this
function. Given argument x, the new functor will return
fnthis(g(x), h(x))
|
compose | public BinaryFunctor<F1, F2, R> compose(BinaryFunctor<F1, F2, T1> g, BinaryFunctor<F1, F2, T2> h)(Code) | | FactoryMethod that creates a BinaryFunctor that passes its argument to
each of the given functors, and uses the results as the arguments to this
function. Given arguments x and y, the new functor will
return fnthis(g(x,y), h(x,y))
|
distribute | public BinaryFunctor<F1, F2, R> distribute(UnaryFunctor<F1, T1> g, UnaryFunctor<F2, T2> h)(Code) | | FactoryMethod that creates a BinaryFunctor that passes each of its two
arguments to a pair of UnaryFunctors, then uses the results as arguments
to this function. Given arguments x and y, the new functor
will return fnthis(g(x), h(y)) . Note: this
method cannot be called compose, as it is only distinct from the unary
form of compose in its param types and its return type
|
fn | abstract public R fn(T1 arg1, T2 arg2)(Code) | | Executes the function and returns the result.
|
generate | public Generator<R> generate(Generator<T1> gen1, Generator<T2> gen2)(Code) | | FactoryMethod that converts this functor to a Generator by using the two
given generators to produce the arguments. The new functor will return
fnthis(gen1(), gen2()) .
|
generate1st | public UnaryFunctor<T2, R> generate1st(Generator<T1> gen)(Code) | | FactoryMethod that converts this functor to a UnaryFunctor by using the
given generator to produce the first argument. Given argument y,
the new functor will return fnthis(gen(), y) .
|
generate2nd | public UnaryFunctor<T1, R> generate2nd(Generator<T2> gen)(Code) | | FactoryMethod that converts this functor to a UnaryFunctor by using the
given generator to produce the first argument. Given argument x,
the new functor will return fnthis(x, gen()) .
|
|
|