| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.fn.Functor<R>
net.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-2005 David A. Hall
| Constructor Summary | |
|---|---|
| BinaryFunctor() | |
| Method Summary | ||
|---|---|---|
|  Generator<R> | bind(T1 value1,
     T2 value2)Factory method that creates a Generator that binds constant values to this' arguments. | |
|  Functor<R> | bind0th(java.lang.Object arg0,
        java.lang.Object... args)Binds the given values to this functor, starting from the first argument. | |
|  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. | |
|  Functor<R> | bindNth(int idx,
        java.lang.Object arg0,
        java.lang.Object... args)Binds the given values to this functor, starting from the given index. | |
| 
 | 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. | |
|  Functor<R> | composeNth(int idx,
           UnaryFunctor<?,?> uf)Modifies the argument at the given index using the given functor | |
| 
 | 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. | |
|  R | eval(java.lang.Object... args)Executes the function and returns the result. | |
| 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. | |
|  Functor<R> | generateNth(int idx,
            Generator<?> gen)Generates the argument at the given index to this functor | |
| Methods inherited from class net.sf.jga.fn.Functor | 
|---|
| accept, composeNth | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface net.sf.jga.fn.Visitable | 
|---|
| accept | 
| 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(fn(), y).
public UnaryFunctor<T1,R> generate2nd(Generator<T2> gen)
fnthis(x, fn()).
public Generator<R> generate(Generator<T1> gen1,
                             Generator<T2> gen2)
fnthis(gen1(), gen2()).
public R eval(java.lang.Object... args)
eval in class Functor<R>
public Functor<R> bind0th(java.lang.Object arg0,
                          java.lang.Object... args)
bind0th in class Functor<R>arg0 - args - 
public Functor<R> bindNth(int idx,
                          java.lang.Object arg0,
                          java.lang.Object... args)
bindNth in class Functor<R>idx - arg0 - args - 
public Functor<R> generateNth(int idx,
                              Generator<?> gen)
generateNth in class Functor<R>idx - arg0 - args - 
public Functor<R> composeNth(int idx,
                             UnaryFunctor<?,?> uf)
composeNth in class Functor<R>idx - arg0 - args - 
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||