endrov.util.lazy
Class MemoizeX<E>

java.lang.Object
  extended by endrov.util.lazy.MemoizeX<E>
All Implemented Interfaces:
ProgressHandle.Stoppable
Direct Known Subclasses:
EvImageReader, MemoizeXImmediate

public abstract class MemoizeX<E>
extends java.lang.Object
implements ProgressHandle.Stoppable

Lazy evaluation and memoization. Haskell semantics for java. My special brew with many additions


Field Summary
protected  java.util.Set<java.lang.Object> locksValue
           
 
Constructor Summary
MemoizeX()
           
 
Method Summary
 void dependsOn(MemoizeX<?> m)
           
protected abstract  E eval(ProgressHandle c)
          Evaluate value
 void evaluatePermanently(ProgressHandle c)
          Evaluate value permanently.
 boolean forget()
          Try and remove the calculated value from memory
 E get(ProgressHandle c)
          Get the value of this object.
 java.lang.Long getLastEvalTime()
           
 boolean isEvaluated()
           
static void main(java.lang.String[] args)
           
 void signalStop()
          Notify that execution *might* be canceled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locksValue

protected java.util.Set<java.lang.Object> locksValue
Constructor Detail

MemoizeX

public MemoizeX()
Method Detail

getLastEvalTime

public java.lang.Long getLastEvalTime()

evaluatePermanently

public void evaluatePermanently(ProgressHandle c)
Evaluate value permanently. After this the value cannot be forgotten


forget

public boolean forget()
Try and remove the calculated value from memory

Returns:
If the value could be forgotten

eval

protected abstract E eval(ProgressHandle c)
Evaluate value


isEvaluated

public boolean isEvaluated()

get

public E get(ProgressHandle c)
Get the value of this object. Calculates the optimal way of executing previous objects and executes


dependsOn

public void dependsOn(MemoizeX<?> m)

signalStop

public void signalStop()
Notify that execution *might* be canceled

Specified by:
signalStop in interface ProgressHandle.Stoppable

main

public static void main(java.lang.String[] args)