org.aspectbench.tm.runtime.internal
Class WeakKeyIdentityHashMap

java.lang.Object
  extended byorg.aspectbench.tm.runtime.internal.IdentityHashMap
      extended byorg.aspectbench.tm.runtime.internal.WeakKeyIdentityHashMap
All Implemented Interfaces:
java.util.Map

public class WeakKeyIdentityHashMap
extends IdentityHashMap

Part of the Indexing Data Structure implementation. This is a HashMap-like data structure that uses key identity as the basis for comparison. It isn't quite conformant to the java.util.Map interface, since its hasNext() method is (by design) unreliable. Instead, next() should be called and the return value checked for non-nullness. This class uses weak references for its keys, but does *not* drop a mapping after a key expires -- it is still iterable. Only the methods of the Map interface that are required by the IDS are implemented, all others just throw an exception.

Author:
Pavel Avgustinov

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class org.aspectbench.tm.runtime.internal.IdentityHashMap
data, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, loadFactor, MAXIMUM_CAPACITY, modCount, size, threshold
 
Constructor Summary
WeakKeyIdentityHashMap()
           
WeakKeyIdentityHashMap(int initialCapacity)
           
WeakKeyIdentityHashMap(int initialCapacity, float loadFactor)
           
WeakKeyIdentityHashMap(int initialCapacity, float loadFactor, int threshold)
           
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          
static java.lang.Object getMarker(java.lang.Object key)
          If the given object is already a Marker, it is returned unchanged.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          
 java.lang.Object remove(java.lang.Object key)
          
 java.lang.Object safeRemove(java.lang.Object key)
          {@inheritDoc}
 
Methods inherited from class org.aspectbench.tm.runtime.internal.IdentityHashMap
calculateNewCapacity, calculateThreshold, checkCapacity, clear, containsKey, containsValue, entrySet, hashIndex, hashIndex, hashIndexFromCode, hashIndexFromCode, isEmpty, keyIterator, keySet, putAll, rebalance, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

WeakKeyIdentityHashMap

public WeakKeyIdentityHashMap()

WeakKeyIdentityHashMap

public WeakKeyIdentityHashMap(int initialCapacity,
                              float loadFactor,
                              int threshold)

WeakKeyIdentityHashMap

public WeakKeyIdentityHashMap(int initialCapacity,
                              float loadFactor)

WeakKeyIdentityHashMap

public WeakKeyIdentityHashMap(int initialCapacity)
Method Detail

getMarker

public static java.lang.Object getMarker(java.lang.Object key)
If the given object is already a Marker, it is returned unchanged. Otherwise, the Marker representing that particular object is (constructed, if necessary, and) returned.


get

public java.lang.Object get(java.lang.Object key)

Specified by:
get in interface java.util.Map
Overrides:
get in class IdentityHashMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

Specified by:
put in interface java.util.Map
Overrides:
put in class IdentityHashMap

remove

public java.lang.Object remove(java.lang.Object key)

Specified by:
remove in interface java.util.Map
Overrides:
remove in class IdentityHashMap

safeRemove

public java.lang.Object safeRemove(java.lang.Object key)
{@inheritDoc}