|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.intermine.util.ReferenceMap<K,V>
K - the type of keys maintained by this mapV - the type of mapped valuespublic abstract class ReferenceMap<K,V>
This is a Map implementation designed specifically for people intending to create a cache. The class should be subclassed to provide soft or weak reference behaviour. The keys are held strongly, but the values are held weakly or softly, so the values can be garbage-collected. When an entry is garbage-collected, its key is removed from the Map on the next Map activity.
The entrySet() and values() methods of this class do not work.
SoftReference| Nested Class Summary | |
|---|---|
protected static interface |
ReferenceMap.ReferenceWithKey<K>
Interface for entries in the map. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected java.lang.String |
name
|
protected static org.intermine.util.ReferenceMap.NullValue |
NULL_VALUE
|
protected java.lang.ref.ReferenceQueue<java.lang.Object> |
queue
|
protected java.util.Map<K,java.lang.ref.Reference<java.lang.Object>> |
subMap
|
| Constructor Summary | |
|---|---|
ReferenceMap()
|
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(java.lang.Object o)
|
V |
get(java.lang.Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
protected abstract java.lang.ref.Reference<java.lang.Object> |
newRef(java.lang.Object value,
java.lang.ref.ReferenceQueue<java.lang.Object> queue,
K key)
Private method to create a new ReferenceWithKey object. |
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> t)
|
V |
remove(java.lang.Object key)
|
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.intermine.util.ReferenceMap.NullValue NULL_VALUE
protected java.util.Map<K,java.lang.ref.Reference<java.lang.Object>> subMap
protected java.lang.ref.ReferenceQueue<java.lang.Object> queue
protected java.lang.String name
| Constructor Detail |
|---|
public ReferenceMap()
| Method Detail |
|---|
public int size()
size in interface java.util.Map<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>public void clear()
clear in interface java.util.Map<K,V>public V get(java.lang.Object key)
get in interface java.util.Map<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>
public V put(K key,
V value)
put in interface java.util.Map<K,V>
protected abstract java.lang.ref.Reference<java.lang.Object> newRef(java.lang.Object value,
java.lang.ref.ReferenceQueue<java.lang.Object> queue,
K key)
value - the value put into the Referencequeue - the ReferenceQueue to register the Reference inkey - the key
public void putAll(java.util.Map<? extends K,? extends V> t)
putAll in interface java.util.Map<K,V>public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>public boolean equals(java.lang.Object o)
equals in interface java.util.Map<K,V>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.Map<K,V>hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||