|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjade.util.HashCache
public class HashCache
This class is a cache with fixed dimension that can be set in the constructur. All element are indexed with an hashcode. When an element is added and the cache is already full,the oldest element is deleted.
| Constructor Summary | |
|---|---|
HashCache(int cacheSize)
Constructs a new, empty HashCache with the specified size. |
|
| Method Summary | |
|---|---|
java.lang.Object |
add(java.lang.Object o)
Adds the specified element to this hashcache if it is not already present. |
void |
clear()
Clears the cache, removing all key-value pairs |
boolean |
contains(java.lang.Object o)
Tests if the specified object is a key in this hashcache. |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key. |
java.lang.Object |
get(java.lang.Object key)
Retrieves a cached element. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
Set |
keySet()
Returns a set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Adds a key-value pair to this cache |
java.lang.Object |
remove(java.lang.Object key)
Remove an existing key-value pair from the cache |
int |
size()
Returns the number of mappings in this map. |
Collection |
values()
Returns a Collection view of the values contained in this map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HashCache(int cacheSize)
cacheSize - is the size of this cache| Method Detail |
|---|
public java.lang.Object add(java.lang.Object o)
o - element to be added to this set.
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface Mapkey - The key with which the value can be retrieved in
the future.value - The value to store in the cache.
Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface Mapo - The key to be removed (together with its associated value.
Mappublic boolean contains(java.lang.Object o)
o - element to be added to this set.
o,
otherwise falsepublic java.lang.Object get(java.lang.Object key)
get in interface Mapo - The
Mappublic void clear()
clear in interface MapMappublic boolean isEmpty()
Map
isEmpty in interface MapMappublic Set keySet()
Map
keySet in interface MapMappublic Collection values()
Map
values in interface MapMappublic boolean containsKey(java.lang.Object key)
Map
containsKey in interface Mapkey - key whose presence in this map is to be tested.
Mappublic int size()
Map
size in interface MapMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||