net.ontopia.utils
Class SoftHashMapIndex<K,E>
java.lang.Object
net.ontopia.utils.SoftHashMapIndex<K,E>
- All Implemented Interfaces:
- LookupIndexIF<K,E>
- Direct Known Subclasses:
- TransactionalSoftHashMapIndex
public class SoftHashMapIndex<K,E>
- extends java.lang.Object
- implements LookupIndexIF<K,E>
INTERNAL: A lookup index implementation that uses soft references
for the keys, 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 keys 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().
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
entries
public SoftHashMapIndex.SoftEntry<K,E>[] entries
SoftHashMapIndex
public SoftHashMapIndex()
get
public E get(K key)
- Specified by:
get
in interface LookupIndexIF<K,E>
getKey
public K getKey(K key)
put
public E put(K key,
E value)
- Specified by:
put
in interface LookupIndexIF<K,E>
remove
public E remove(K key)
- Specified by:
remove
in interface LookupIndexIF<K,E>
rehash
protected void rehash()
- INTERNAL: Figures out correct size for rehashed set, then does
the rehash.
size
public int size()
writeReport
public void writeReport(java.io.Writer out)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2000-2012 Ontopia.