net.ontopia.utils
Class SoftValueHashMapIndex
java.lang.Object
net.ontopia.utils.SoftValueHashMapIndex
- All Implemented Interfaces:
- LookupIndexIF
public class SoftValueHashMapIndex
- extends java.lang.Object
- implements LookupIndexIF
INTERNAL: A lookup index implementation that uses soft references
for the values, in order to allow them to be garbage-collected. It
doesn't support a fallback, since this is not needed where it is
used. It's simply a cache that allows its values to be GC-ed. Note
that the keys passed in should not be SoftReferences; the index
will wrap them as references where needed.
General approach is closed hashing, like in CompactHashSet.
We simplify a little by assuming that null keys do not occur in
put() and remove().
Method Summary |
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
getKey(java.lang.Object key)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
void |
writeReport(java.io.Writer out)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
entries
public SoftValueHashMapIndex.SoftEntry[] entries
SoftValueHashMapIndex
public SoftValueHashMapIndex()
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get
in interface LookupIndexIF
getKey
public java.lang.Object getKey(java.lang.Object key)
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put
in interface LookupIndexIF
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
remove
in interface LookupIndexIF
size
public int size()
writeReport
public void writeReport(java.io.Writer out)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2000-2012 Ontopia.