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

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

public class Generate2nd<T1,T2,R>
extends UnaryFunctor<T1,R>

UnaryFunctor that uses a Generator to produce the 2nd argument to a given BinaryFunctor.

Copyright © 2004-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface Generate2nd.Visitor
          Interface for classes that may interpret a Generate2nd functor.
 
Constructor Summary
Generate2nd(BinaryFunctor<T1,T2,R> fn, Generator<T2> gen)
           
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Generate2nd) method, if it implements the nested Visitor interface.
 R fn(T1 arg)
          Returns the results of the functor, using the nested generator to produce the first argument.
 BinaryFunctor<T1,T2,R> getFunctor()
          Returns the Functor that is invoked
 Generator<T2> getGenerator()
          Returns the generator that produces the 2nd argument.
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.UnaryFunctor
bind, bind0th, bindNth, compose, compose, compose, composeNth, composeNth, eval, generate, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Generate2nd

public Generate2nd(BinaryFunctor<T1,T2,R> fn,
                   Generator<T2> gen)
Method Detail

getFunctor

public BinaryFunctor<T1,T2,R> getFunctor()
Returns the Functor that is invoked


getGenerator

public Generator<T2> getGenerator()
Returns the generator that produces the 2nd argument.


fn

public R fn(T1 arg)
Returns the results of the functor, using the nested generator to produce the first argument.

Specified by:
fn in class UnaryFunctor<T1,R>

accept

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