|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.aspectbench.tm.runtime.internal.IdentityHashMap
public class IdentityHashMap
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.HashEntry[] |
data
Map entries |
protected static int |
DEFAULT_CAPACITY
The default capacity to use |
protected static float |
DEFAULT_LOAD_FACTOR
The default load factor to use |
protected static int |
DEFAULT_THRESHOLD
The default threshold to use |
protected float |
loadFactor
Load factor, normally 0.75 |
protected static int |
MAXIMUM_CAPACITY
The maximum capacity allowed |
protected int |
modCount
Modification count for iterators |
protected int |
size
The size of the map |
protected int |
threshold
Size at which to rehash |
Constructor Summary | |
---|---|
IdentityHashMap()
|
|
IdentityHashMap(int initialCapacity)
|
|
IdentityHashMap(int initialCapacity,
float loadFactor)
|
|
IdentityHashMap(int initialCapacity,
float loadFactor,
int threshold)
|
Method Summary | |
---|---|
protected static int |
calculateNewCapacity(int proposedCapacity)
Calculates the new capacity of the map. |
protected static int |
calculateThreshold(int newCapacity,
float factor)
Calculates the new threshold of the map, where it will be resized. |
protected void |
checkCapacity()
Increases the number of buckets if necessary. |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.EntryIterator |
entryIterator()
Constructs an EntryIterator object |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
protected int |
hashIndex(java.lang.Object key)
Calculates the hash bucket for this key. |
protected int |
hashIndex(java.lang.Object key,
int capacity)
Calculates the hash bucket for the given key, assuming the given number of buckets. |
protected int |
hashIndexFromCode(int hashCode)
Calculates the hash bucket this hashCode should go into. |
protected int |
hashIndexFromCode(int hashCode,
int capacity)
Calculates the hash bucket this hashCode should go into, assuming the given number of buckets |
boolean |
isEmpty()
Strictly speaking, this shoudn't be used for checking emptiness, since the intention is for subclasses to provide weak-key maps, i.e. |
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.KeyIterator |
keyIterator()
Constructs a KeyIterator object |
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map arg0)
|
protected void |
rebalance(int n)
Increases the number of buckets and re-distributes the entries into the new buckets. |
java.lang.Object |
remove(java.lang.Object key)
|
protected java.lang.Object |
safeRemove(java.lang.Object key)
Removes the key/value pair corresponding to the hidden key in a "safe" way. |
int |
size()
Return the number of key/value pairs in the map. |
java.util.Collection |
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 |
Field Detail |
---|
protected static final int DEFAULT_CAPACITY
protected static final int DEFAULT_THRESHOLD
protected static final float DEFAULT_LOAD_FACTOR
protected static final int MAXIMUM_CAPACITY
protected transient float loadFactor
protected transient int size
protected transient org.aspectbench.tm.runtime.internal.IdentityHashMap.HashEntry[] data
protected transient int threshold
protected transient int modCount
Constructor Detail |
---|
public IdentityHashMap()
public IdentityHashMap(int initialCapacity)
public IdentityHashMap(int initialCapacity, float loadFactor)
public IdentityHashMap(int initialCapacity, float loadFactor, int threshold)
Method Detail |
---|
public int size()
size
in interface java.util.Map
protected static int calculateNewCapacity(int proposedCapacity)
proposedCapacity
- the proposed capacity
protected static int calculateThreshold(int newCapacity, float factor)
newCapacity
- the new capacityfactor
- the load factor
protected int hashIndexFromCode(int hashCode)
hashCode
- the pre-computed hashCode of the object
protected int hashIndexFromCode(int hashCode, int capacity)
hashCode
- the pre-computed hashCode of the objectcapacity
- the target number of buckets
protected int hashIndex(java.lang.Object key)
protected int hashIndex(java.lang.Object key, int capacity)
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
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.Map
protected void checkCapacity()
protected void rebalance(int n)
n
- the desired new number of buckets -- should be a power of 2.public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
protected java.lang.Object safeRemove(java.lang.Object key)
public void putAll(java.util.Map arg0)
putAll
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.KeyIterator keyIterator()
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.EntryIterator entryIterator()
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |