endrov.util.lazy
Class ForgetfulMemoize<E>

java.lang.Object
  extended by endrov.util.lazy.ForgetfulMemoize<E>

public abstract class ForgetfulMemoize<E>
extends java.lang.Object

Lazy evaluation and memoization and forgetting. Haskell semantics for java with a twist. The idea is that cheap results can be thrown away, "forgetting". This has no effect on pure functions except trading memory for CPU. Forgetting is currently not implemented.


Constructor Summary
ForgetfulMemoize()
           
 
Method Summary
protected abstract  E eval()
          Evaluate value
 E get()
          Get value, evaluate if required.
 E getPermanent()
           
 boolean isPermanent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForgetfulMemoize

public ForgetfulMemoize()
Method Detail

get

public E get()
Get value, evaluate if required. Evaluation occurs at most once


getPermanent

public E getPermanent()

isPermanent

public boolean isPermanent()

eval

protected abstract E eval()
Evaluate value