net.sf.jga.fn.adaptor
Class CompoundBinary<T1,T2,R>

java.lang.Object
  extended by net.sf.jga.fn.Functor<R>
      extended by net.sf.jga.fn.BinaryFunctor<T1,T2,R>
          extended by net.sf.jga.fn.adaptor.CompoundBinary<T1,T2,R>
All Implemented Interfaces:
java.io.Serializable, Visitable

public class CompoundBinary<T1,T2,R>
extends BinaryFunctor<T1,T2,R>

Executes two BinaryFunctors, returning the results of the second.

Copyright © 2005 David A. Hall

See Also:
Serialized Form

Nested Class Summary
static interface CompoundBinary.Visitor
          Interface for classes that may interpret a Constant binaryFunctor.
 
Constructor Summary
CompoundBinary(BinaryFunctor<T1,T2,?> fn1, BinaryFunctor<T1,T2,R> fn2)
           
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(CompoundBinary) method, if it implements the nested Visitor interface.
 R fn(T1 arg1, T2 arg2)
          Executes both functors, returning the results of the second.
 BinaryFunctor<T1,T2,?> getFirstFunctor()
           
 BinaryFunctor<T1,T2,R> getSecondFunctor()
           
 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

CompoundBinary

public CompoundBinary(BinaryFunctor<T1,T2,?> fn1,
                      BinaryFunctor<T1,T2,R> fn2)
Method Detail

getFirstFunctor

public BinaryFunctor<T1,T2,?> getFirstFunctor()
Returns:
the first of the two nested functors

getSecondFunctor

public BinaryFunctor<T1,T2,R> getSecondFunctor()
Returns:
the second of the two nested functors

fn

public R fn(T1 arg1,
            T2 arg2)
Executes both functors, returning the results of the second.

Specified by:
fn in class BinaryFunctor<T1,T2,R>

accept

public void accept(Visitor v)
Calls the Visitor's visit(CompoundBinary) method, if it implements the nested Visitor interface.

Specified by:
accept in interface Visitable
Overrides:
accept in class Functor<R>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2006 David A. Hall. All Rights Reserved.