jpaul.Misc
Class CachedFunction<TArg,TRes>

java.lang.Object
  extended by jpaul.Misc.Function<TArg,TRes>
      extended by jpaul.Misc.CachedFunction<TArg,TRes>

public class CachedFunction<TArg,TRes>
extends Function<TArg,TRes>

CachedFunction is a caching wrapper around a (presumably pure) function.

Version:
$Id: CachedFunction.java,v 1.6 2006/03/14 02:29:31 salcianu Exp $
Author:
Alexandru Salcianu - salcianu@alum.mit.edu

Constructor Summary
CachedFunction(Function<TArg,TRes> func)
          Constructs a caching wrapper around the function func.
 
Method Summary
 TRes f(TArg arg)
          Takes a TRes and returns a TArg.
 
Methods inherited from class jpaul.Misc.Function
comp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedFunction

public CachedFunction(Function<TArg,TRes> func)
Constructs a caching wrapper around the function func. func should be (observationally) pure (we have no way of checking this, so impure functions are likely to result in hard to find errors).

Method Detail

f

public TRes f(TArg arg)
Description copied from class: Function
Takes a TRes and returns a TArg. The real function!

Specified by:
f in class Function<TArg,TRes>


Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu