|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.util.FixedsizeForgetfulHashMap
A stronger version of ForgetfulHashMap. Like ForgetfulHashMap, this is a mapping that "forgets" keys and values using a FIFO replacement policy, much like a cache. Unlike ForgetfulHashMap, it has better-defined replacement policy. Specifically, it allows a key to be remapped to a different value and then "renews" this key so it is the last key to be replaced. All of this is done in constant time.
Restrictions:
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
FixedsizeForgetfulHashMap(int size)
Create a new instance that holds only the last "size" entries. |
|
| Method Summary | |
void |
clear()
Removes all mappings from this map. |
java.lang.Object |
clone()
Returns a shallow copy of this Map instance: the keys and values themselves are not cloned. |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
Not implemented; behavior undefined |
java.util.Set |
entrySet()
Not implemented; behavior undefined |
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(java.lang.Object key)
Returns the value associated with this key. |
int |
hashCode()
|
boolean |
isEmpty()
|
boolean |
isFull()
Tests if the map is full |
java.util.Set |
keySet()
Partially implemented. Only keySet().iterator() is well defined. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map. |
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified map to this one. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this map if present. |
java.lang.Object |
removeLRUEntry()
Removes the least recently used entry from the map |
void |
repOk()
Tests the invariants described above. |
int |
size()
|
java.util.Collection |
values()
Not implemented; behavior undefined |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FixedsizeForgetfulHashMap(int size)
size - the number of entries to hold
java.lang.IllegalArgumentException - if size is less < 1.| Method Detail |
public java.lang.Object get(java.lang.Object key)
get in interface java.util.Map
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapkey - key with which the specified value is to be associated.value - value to be associated with the specified key, which must
not be null
public boolean isFull()
public java.lang.Object removeLRUEntry()
public void putAll(java.util.Map t)
putAll in interface java.util.Mapt - Mappings to be stored in this map.public java.lang.Object clone()
public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapkey - key whose mapping is to be removed from the map.
public void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mappublic boolean equals(java.lang.Object o)
equals in interface java.util.Mappublic int hashCode()
hashCode in interface java.util.Mappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic int size()
size in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic void repOk()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||