net.sf.jga.fn
Class Generator<R>

java.lang.Object
  extended by net.sf.jga.fn.Functor<R>
      extended by net.sf.jga.fn.Generator<R>
All Implemented Interfaces:
java.io.Serializable, Visitable
Direct Known Subclasses:
AndGenerator, ApplyGenerator, Bind, CompoundGenerator, ConditionalGenerator, Constant, ConstructDefault, Generate, Identity.Accessor, OrGenerator, Random

public abstract class Generator<R>
extends Functor<R>
implements java.io.Serializable, Visitable

Functor that takes no arguments and produces a single result. The result is not guaranteed to be the same each time the functor is called.

Copyright © 2004-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Constructor Summary
Generator()
           
 
Method Summary
 Functor<R> bind0th(java.lang.Object arg0, java.lang.Object... args)
          Binds the given values to this functor, starting from the first argument.
 Functor<R> bindNth(int idx, java.lang.Object arg0, java.lang.Object... args)
          Binds the given values to this functor, starting from the given index.
 R eval(java.lang.Object... args)
          Executes the function and returns the result.
abstract  R fn()
          Generate one instance.
 
Methods inherited from class net.sf.jga.fn.Functor
accept, composeNth, composeNth, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jga.fn.Visitable
accept
 

Constructor Detail

Generator

public Generator()
Method Detail

fn

public abstract R fn()
Generate one instance.


eval

public R eval(java.lang.Object... args)
Executes the function and returns the result.

Specified by:
eval in class Functor<R>

bind0th

public Functor<R> bind0th(java.lang.Object arg0,
                          java.lang.Object... args)
Binds the given values to this functor, starting from the first argument.

Overrides:
bind0th in class Functor<R>
Parameters:
arg0 -
args -
Returns:

bindNth

public Functor<R> bindNth(int idx,
                          java.lang.Object arg0,
                          java.lang.Object... args)
Binds the given values to this functor, starting from the given index.

Overrides:
bindNth in class Functor<R>
Parameters:
idx -
arg0 -
args -
Returns:


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