net.sf.jga.fn.adaptor
Class Compound<R>

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

public class Compound<R>
extends Functor<R>

Executes two Functors, returning the results of the second.

Copyright © 2005 David A. Hall

See Also:
Serialized Form

Nested Class Summary
static interface Compound.Visitor
          Interface for classes that may interpret a Constant binaryFunctor.
 
Constructor Summary
Compound(Functor<?> fn1, Functor<R> fn2)
           
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Compound) method, if it implements the nested Visitor interface.
 R eval(java.lang.Object... args)
          A non-typesafe evaluation method for function objects.
 Functor<?> getFirstFunctor()
           
 Functor<R> getSecondFunctor()
           
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.Functor
bind0th, bindNth, composeNth, composeNth, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Compound

public Compound(Functor<?> fn1,
                Functor<R> fn2)
Method Detail

getFirstFunctor

public Functor<?> getFirstFunctor()
Returns:
the first of the two nested functors

getSecondFunctor

public Functor<R> getSecondFunctor()
Returns:
the second of the two nested functors

eval

public R eval(java.lang.Object... args)
Description copied from class: Functor
A non-typesafe evaluation method for function objects. The number and types of arguments is not checked at compile time: an invalid number of arguments may cause IndexOutOfBoundsException (or cause extraneous arguments to be ignored); an argument of an invalid type may cause a ClassCastException.

Specified by:
eval in class Functor<R>

accept

public void accept(Visitor v)
Calls the Visitor's visit(Compound) 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.