com.ibm.wbi.util
Class Cache

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--com.ibm.wbi.util.Cache
Direct Known Subclasses:
LRUCache

public abstract class Cache
extends java.util.Dictionary

An abstract base class for performing simple caching functions.

See Also:
Dictionary

Constructor Summary
Cache()
           
 
Method Summary
abstract  void clear()
          Clears the cache so that it contains no keys or values.
abstract  java.util.Enumeration elements()
          Returns an enumeration of the values in this cache.
abstract  java.lang.Object get(java.lang.Object key)
          Returns the value to which the key is mapped in the cache.
abstract  boolean isEmpty()
          Tests whether this cache contains no keys.
abstract  java.util.Enumeration keys()
          Returns an enumeration of the keys in this cache.
abstract  java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value in this cache.
abstract  java.lang.Object remove(java.lang.Object key)
          Removes the specified key and the value to which it is mapped from the cache.
abstract  int size()
          Returns the number of keys which are mapped to values in this cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

elements

public abstract java.util.Enumeration elements()
Returns an enumeration of the values in this cache.
Overrides:
elements in class java.util.Dictionary
Returns:
an enumeration of the values in this cache.

get

public abstract java.lang.Object get(java.lang.Object key)
Returns the value to which the key is mapped in the cache.
Overrides:
get in class java.util.Dictionary
Parameters:
key - A key in the cache.
Returns:
The value to which the key is mapped, or null if the key is not mapped to any value.

isEmpty

public abstract boolean isEmpty()
Tests whether this cache contains no keys.
Overrides:
isEmpty in class java.util.Dictionary
Returns:
true if the cache contains no keys; false otherwise.

keys

public abstract java.util.Enumeration keys()
Returns an enumeration of the keys in this cache.
Overrides:
keys in class java.util.Dictionary
Returns:
an enumeration of the keys in this cache.

put

public abstract java.lang.Object put(java.lang.Object key,
                                     java.lang.Object value)
Maps the specified key to the specified value in this cache. Neither the key nor the value may be null.
Overrides:
put in class java.util.Dictionary
Parameters:
key - The key
value - The value
Returns:
The previous value to which key was mapped, or null if key was not mapped to any value.
Throws:
NullPointerException - If key or value is null.

remove

public abstract java.lang.Object remove(java.lang.Object key)
Removes the specified key and the value to which it is mapped from the cache. This method does nothing if the key is not mapped to any value.
Overrides:
remove in class java.util.Dictionary
Parameters:
key - The key to be removed
Returns:
The value to which key was mapped, or null if key was not mapped to any value.

size

public abstract int size()
Returns the number of keys which are mapped to values in this cache.
Overrides:
size in class java.util.Dictionary
Returns:
the number of keys which are mapped to values in this cache.

clear

public abstract void clear()
Clears the cache so that it contains no keys or values.