|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.fn.BinaryFunctor<T1,T2,R>
public abstract class BinaryFunctor<T1,T2,R>
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 David A. Hall
| Constructor Summary | |
|---|---|
BinaryFunctor()
|
|
| Method Summary | ||
|---|---|---|
void |
accept(Visitor v)
No-op implementation of Visitable interface. |
|
Generator<R> |
bind(T1 value1,
T2 value2)
Factory method that creates a Generator that binds constant values to this' arguments. |
|
UnaryFunctor<T2,R> |
bind1st(T1 value)
Factory method that creates a UnaryFunctor that binds a constant value to this' first argument. |
|
UnaryFunctor<T1,R> |
bind2nd(T2 value)
Factory method that creates a UnaryFunctor that binds a constant value to this' second argument. |
|
|
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. |
|
|
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. |
|
|
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. |
|
abstract R |
fn(T1 arg1,
T2 arg2)
Executes the function and returns the result. |
|
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. |
|
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. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BinaryFunctor()
| Method Detail |
|---|
public abstract R fn(T1 arg1,
T2 arg2)
public UnaryFunctor<T2,R> bind1st(T1 value)
fnthis(value, x)
public UnaryFunctor<T1,R> bind2nd(T2 value)
fnthis(x, value)
public Generator<R> bind(T1 value1,
T2 value2)
fnthis(value1, value2)
public <F> UnaryFunctor<F,R> compose(UnaryFunctor<F,T1> g,
UnaryFunctor<F,T2> h)
fnthis(g(x), h(x))
public <F1,F2> BinaryFunctor<F1,F2,R> compose(BinaryFunctor<F1,F2,T1> g,
BinaryFunctor<F1,F2,T2> h)
fnthis(g(x,y), h(x,y))
public <F1,F2> BinaryFunctor<F1,F2,R> distribute(UnaryFunctor<F1,T1> g,
UnaryFunctor<F2,T2> h)
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
public UnaryFunctor<T2,R> generate1st(Generator<T1> gen)
fnthis(gen(), y).
public UnaryFunctor<T1,R> generate2nd(Generator<T2> gen)
fnthis(x, gen()).
public Generator<R> generate(Generator<T1> gen1,
Generator<T2> gen2)
fnthis(gen1(), gen2()).
public void accept(Visitor v)
accept in interface Visitable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||