|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.fn.Functor<R> net.sf.jga.fn.BinaryFunctor<T1,T2,R> net.sf.jga.fn.adaptor.Distribute<T1,T2,F1,F2,R>
public class Distribute<T1,T2,F1,F2,R>
Binary Functor that passes its two arguments to two inner Unary Functors, and uses the results as arguments to an outer Binary Functor. This allows for the construction of compound functors from the primitives found in the arithmetic, logical, property, and comparison packages.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
Distribute.Visitor
Interface for classes that may interpret a Distribute functor. |
Constructor Summary | |
---|---|
Distribute(UnaryFunctor<T1,F1> f,
UnaryFunctor<T2,F2> g,
BinaryFunctor<F1,F2,R> h)
Builds a Distribute functor, given two inner functors f and g, and outer functor h. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(Distribute) method, if it
implements the nested Visitor interface. |
R |
fn(T1 x,
T2 y)
Passes arguments x and y to the corresponding inner functors, and passes the results of those functors to the outer functor. |
UnaryFunctor<T1,F1> |
getFirstInnerFunctor()
Returns the first of two inner functors |
BinaryFunctor<F1,F2,R> |
getOuterFunctor()
Returns the outer functor |
UnaryFunctor<T2,F2> |
getSecondInnerFunctor()
Returns the second of two inner functors |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.BinaryFunctor |
---|
bind, bind0th, bind1st, bind2nd, bindNth, compose, compose, composeNth, distribute, eval, generate, generate1st, generate2nd, generateNth |
Methods inherited from class net.sf.jga.fn.Functor |
---|
composeNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Distribute(UnaryFunctor<T1,F1> f, UnaryFunctor<T2,F2> g, BinaryFunctor<F1,F2,R> h)
java.lang.IllegalArgumentException
- if any of the functors is missingMethod Detail |
---|
public UnaryFunctor<T1,F1> getFirstInnerFunctor()
public UnaryFunctor<T2,F2> getSecondInnerFunctor()
public BinaryFunctor<F1,F2,R> getOuterFunctor()
public R fn(T1 x, T2 y)
fn
in class BinaryFunctor<T1,T2,R>
public void accept(Visitor v)
visit(Distribute)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<R>
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |