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

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

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

UnaryFunctor that uses a Generator to produce the 1st argument to a given BinaryFunctor.

Copyright © 2004-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface Generate1st.Visitor
          Interface for classes that may interpret a Generate1st functor.
 
Constructor Summary
Generate1st(BinaryFunctor<T1,T2,R> fn, Generator<T1> gen)
           
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Generate1st) method, if it implements the nested Visitor interface.
 R fn(T2 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<T1> getGenerator()
          Returns the generator that produces the 1st 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

Generate1st

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

getFunctor

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


getGenerator

public Generator<T1> getGenerator()
Returns the generator that produces the 1st argument.


fn

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

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

accept

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