de.kosi.gui.util
Class Cache

java.lang.Object
  |
  +--de.kosi.gui.util.Cache

public class Cache
extends java.lang.Object

An object that holds a maximum of size key value entries. A full cache removes the least recently used entry if a new one enters it. An object gets used when it gets accessed by the get(Object) method. We use this class to cache filtered images.


Field Summary
protected  java.util.Vector fifo
           
protected  java.util.Hashtable hashtable
           
protected  int size
          The maximum number of objects that can be stored in this cache.
 
Constructor Summary
Cache(int size)
          Creates a cache with size entries.
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          Looks and returns an object from this cache.
 void put(java.lang.Object key, java.lang.Object obj)
          Puts an object into this cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashtable

protected java.util.Hashtable hashtable

fifo

protected java.util.Vector fifo

size

protected int size
The maximum number of objects that can be stored in this cache.
Constructor Detail

Cache

public Cache(int size)
Creates a cache with size entries.
Parameters:
size - the maximum number of objects that can be stored in this cache.
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Looks and returns an object from this cache.

put

public void put(java.lang.Object key,
                java.lang.Object obj)
Puts an object into this cache.