es.ucm.fdi.hysteria.gui
Class Cache<V,T>

java.lang.Object
  extended by es.ucm.fdi.hysteria.gui.Cache<V,T>
Type Parameters:
V - The "key" object
T - The "requested" object

public class Cache<V,T>
extends java.lang.Object

This class wraps a Hashtable. It works as a cache. If a given T object is requested by a given V object, if it's not already in the Hashtable (A.k.a. already loaded before), it's created and added to the Hashtable

Author:
MiniSandor

Nested Class Summary
static interface Cache.Factory<T>
          Abstract factory interface needed for "teaching" the class how to build a T object.
 
Constructor Summary
Cache(Cache.Factory<T> fact)
           
 
Method Summary
 T getFromCache(V v)
          This method "asks" the cache if a given Object was already created/loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(Cache.Factory<T> fact)
Method Detail

getFromCache

public T getFromCache(V v)
This method "asks" the cache if a given Object was already created/loaded. If it's not, then it creates the Object, and adds to the structure.

Parameters:
v - The "key"
Returns:
The Object