|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap org.apache.commons.collections.map.AbstractHashedMap org.apache.commons.collections.map.AbstractReferenceMap org.apache.commons.collections.map.ReferenceMap org.deduced.utilities.IdentityReferenceMap
public class IdentityReferenceMap
IdentityReferenceMap is used to create a map where the developer can control the way keys and values are referenced and how keys and values are checked for equality. For the reference type on keys and values, see the documentation for ReferenceMap. During construction, boolean flags indicate if keys and values should be compared with the equal function call or the "==" operator.
Nested Class Summary | |
---|---|
protected static class |
IdentityReferenceMap.IdentityReferenceEntry
IdentityReferenceEntry is used to create hash entries in the map. |
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
---|
org.apache.commons.collections.map.AbstractReferenceMap.ReferenceEntry |
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractHashedMap |
---|
org.apache.commons.collections.map.AbstractHashedMap.EntrySet, org.apache.commons.collections.map.AbstractHashedMap.EntrySetIterator, org.apache.commons.collections.map.AbstractHashedMap.HashEntry, org.apache.commons.collections.map.AbstractHashedMap.HashIterator, org.apache.commons.collections.map.AbstractHashedMap.HashMapIterator, org.apache.commons.collections.map.AbstractHashedMap.KeySet, org.apache.commons.collections.map.AbstractHashedMap.KeySetIterator, org.apache.commons.collections.map.AbstractHashedMap.Values, org.apache.commons.collections.map.AbstractHashedMap.ValuesIterator |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
private boolean |
keyByInstance
if true, keys are compared with the "==" operator. |
private static long |
serialVersionUID
serial ID |
private boolean |
valueByInstance
if true, values are compared with the "==" operator. |
Fields inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
---|
HARD, keyType, purgeValues, SOFT, valueType, WEAK |
Fields inherited from class org.apache.commons.collections.map.AbstractHashedMap |
---|
data, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, entrySet, GETKEY_INVALID, GETVALUE_INVALID, keySet, loadFactor, MAXIMUM_CAPACITY, modCount, NO_NEXT_ENTRY, NO_PREVIOUS_ENTRY, NULL, REMOVE_INVALID, SETVALUE_INVALID, size, threshold, values |
Constructor Summary | |
---|---|
IdentityReferenceMap(boolean setKeyByInstance,
boolean setValueByInstance,
int setKeyType,
int setValueType)
IdentityReferenceMap constructor |
|
IdentityReferenceMap(boolean setKeyByInstance,
boolean setValueByInstance,
int setKeyType,
int setValueType,
int capacity,
float setLoadFactor,
boolean setPurgeValues)
IdentityReferenceMap constructor |
Method Summary | |
---|---|
protected org.apache.commons.collections.map.AbstractHashedMap.HashEntry |
createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry next,
int hashCode,
java.lang.Object key,
java.lang.Object value)
Creates an entry to store the data. |
boolean |
equals(java.lang.Object obj)
Compares this map with another. |
int |
getKeyType()
getKeyType |
int |
getValueType()
getValueType |
protected int |
hash(java.lang.Object key)
Gets the hash code for the key specified. |
int |
hashCode()
(non-Javadoc) |
protected int |
hashKey(java.lang.Object key)
hash a key. |
protected int |
hashValue(java.lang.Object value)
hash a value. |
protected boolean |
isEqualKey(java.lang.Object key1,
java.lang.Object key2)
Compares two keys for equals. |
protected boolean |
isEqualValue(java.lang.Object value1,
java.lang.Object value2)
Compares two values for equals. |
boolean |
isKeyByInstance()
is Key By Instance |
boolean |
isValueByInstance()
is Value By Instance |
Methods inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
---|
clear, containsKey, containsValue, createEntrySetIterator, createKeySetIterator, createValuesIterator, doReadObject, doWriteObject, entrySet, get, getEntry, hashEntry, init, isEmpty, keySet, mapIterator, purge, purge, purgeBeforeRead, purgeBeforeWrite, put, remove, size, values |
Methods inherited from class org.apache.commons.collections.map.AbstractHashedMap |
---|
addEntry, addMapping, calculateNewCapacity, calculateThreshold, checkCapacity, clone, convertKey, destroyEntry, ensureCapacity, entryHashCode, entryKey, entryNext, entryValue, hashIndex, putAll, removeEntry, removeMapping, reuseEntry, toString, updateEntry |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private final boolean keyByInstance
private final boolean valueByInstance
Constructor Detail |
---|
public IdentityReferenceMap(boolean setKeyByInstance, boolean setValueByInstance, int setKeyType, int setValueType)
setKeyByInstance
- if true, keys are compared with the "=="
operator. If false, they are compared with a call to the equal
method.setValueByInstance
- if true, keys are compared with the "=="
operator. If false, they are compared with a call to the equal
method.setKeyType
- the type of reference to use for keys; must be
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
, AbstractReferenceMap.WEAK
setValueType
- the type of reference to use for values; must be
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
, AbstractReferenceMap.WEAK
public IdentityReferenceMap(boolean setKeyByInstance, boolean setValueByInstance, int setKeyType, int setValueType, int capacity, float setLoadFactor, boolean setPurgeValues)
setKeyByInstance
- if true, keys are compared with the "=="
operator. If false, they are compared with a call to the equal
method.setValueByInstance
- if true, keys are compared with the "=="
operator. If false, they are compared with a call to the equal
method.setKeyType
- the type of reference to use for keys; must be
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
, AbstractReferenceMap.WEAK
setValueType
- the type of reference to use for values; must be
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
, AbstractReferenceMap.WEAK
capacity
- the initial capacity for the mapsetLoadFactor
- the load factor for the mapsetPurgeValues
- should the value be automatically purged when the
key is garbage collectedMethod Detail |
---|
public boolean isKeyByInstance()
public boolean isValueByInstance()
public int getValueType()
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
,
AbstractReferenceMap.WEAK
public int getKeyType()
AbstractReferenceMap.HARD
, AbstractReferenceMap.SOFT
,
AbstractReferenceMap.WEAK
protected int hash(java.lang.Object key)
hash
in class org.apache.commons.collections.map.AbstractHashedMap
key
- the key to get a hash code for
protected boolean isEqualKey(java.lang.Object key1, java.lang.Object key2)
==
.
isEqualKey
in class org.apache.commons.collections.map.AbstractReferenceMap
key1
- the first key to comparekey2
- the second key to compare
protected boolean isEqualValue(java.lang.Object value1, java.lang.Object value2)
==
.
isEqualValue
in class org.apache.commons.collections.map.AbstractHashedMap
value1
- the first value to comparevalue2
- the second value to compare
protected org.apache.commons.collections.map.AbstractHashedMap.HashEntry createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry next, int hashCode, java.lang.Object key, java.lang.Object value)
createEntry
in class org.apache.commons.collections.map.AbstractReferenceMap
next
- the next entry in sequencehashCode
- the hash code to usekey
- the key to storevalue
- the value to store
protected int hashKey(java.lang.Object key)
key
- the key to hash.
protected int hashValue(java.lang.Object value)
value
- the value to hash.
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map
equals
in class org.apache.commons.collections.map.AbstractHashedMap
obj
- the object to compare to
public int hashCode()
hashCode
in interface java.util.Map
hashCode
in class org.apache.commons.collections.map.AbstractHashedMap
AbstractHashedMap.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |