edu.columbia.surge.unifier
Class UnifierCache

java.lang.Object
  |
  +--edu.columbia.surge.unifier.UnifierCache

public class UnifierCache
extends java.lang.Object
implements Unifier

A unifier cache. It wraps around another unifier instance, caching its results. By defaults it uses a java.util.WeakHashMap to provide the caching, although it can be subclassed to employ other memory allocation tactics.


Field Summary
protected  java.util.Map cache
          The cache.
protected  Unifier unifier
          The unifier being wrapped.
 
Constructor Summary
UnifierCache(Unifier unifier)
          Constructor.
 
Method Summary
 java.lang.String unify(FD fd)
          The unify method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected java.util.Map cache
The cache. The keys are the WeakHashFDs and the values are strings (thre result from the unification.

unifier

protected Unifier unifier
The unifier being wrapped.
Constructor Detail

UnifierCache

public UnifierCache(Unifier unifier)
Constructor. Must specify the unifier to wrap.
Method Detail

unify

public java.lang.String unify(FD fd)
The unify method. It calls the unify method of the underlining unifier if the fd is not in the cache.
Specified by:
unify in interface Unifier