net.sf.jga.fn.adaptor
Class Identity.Accessor<T>

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

public static class Identity.Accessor<T>
extends Generator<T>

A Generator that returns the last value passed to an associated Identity. This allows an Identity to serve as a cache for common subexpressions: if you compose the subexpression within an Identity in it's first appearance in a compound functor, you can use the Identity's Accessor as a replacement for all other appearances of the same subexpression.

See Also:
Serialized Form

Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Constant) method, if it implements the nested Visitor interface.
 T fn()
          Generate one instance.
 Identity<T> getIdentity()
           
 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
 

Method Detail

getIdentity

public Identity<T> getIdentity()

fn

public T fn()
Description copied from class: Generator
Generate one instance.

Specified by:
fn in class Generator<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

accept

public void accept(Visitor v)
Calls the Visitor's visit(Constant) method, if it implements the nested Visitor interface.

Specified by:
accept in interface Visitable
Overrides:
accept in class Functor<T>


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