net.sf.jga.fn.adaptor
Class Generate<T,R>

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

public class Generate<T,R>
extends Generator<R>

Generator that wraps a UnaryFunctor around a nested Generator. The values produced by the nested generator are passed to the functor, and the results returned to the caller.

Copyright © 2004-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface Generate.Visitor
          Interface for classes that may interpret a Generate functor.
 
Constructor Summary
Generate(UnaryFunctor<T,R> fn, Generator<T> gen)
           
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Generate) method, if it implements the nested Visitor interface.
 R fn()
          Returns the results of the nested generator as modified by the functor.
 UnaryFunctor<T,R> getFunctor()
          Returns the UnaryFunctor that is applied to values returned by the nested Generator.
 Generator<T> getGenerator()
          Returns the nested Generator;
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.Generator
bind0th, bindNth, eval
 
Methods inherited from class net.sf.jga.fn.Functor
composeNth, composeNth, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Generate

public Generate(UnaryFunctor<T,R> fn,
                Generator<T> gen)
Method Detail

getFunctor

public UnaryFunctor<T,R> getFunctor()
Returns the UnaryFunctor that is applied to values returned by the nested Generator.


getGenerator

public Generator<T> getGenerator()
Returns the nested Generator;


fn

public R fn()
Returns the results of the nested generator as modified by the functor.

Specified by:
fn in class Generator<R>

accept

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