de.uni_paderborn.robots.misc
Class FHashMap
java.lang.Object
|
+--java.util.AbstractMap
|
+--de.uni_paderborn.robots.misc.FHashMap
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class FHashMap
- extends java.util.AbstractMap
- implements java.util.Map, java.lang.Cloneable, java.io.Serializable
- See Also:
- Serialized Form
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Fields inherited from class java.util.AbstractMap |
values |
|
Method Summary |
private void |
addElementToList(FHashMap.Element elem)
Adds an element before header in the linked list. |
int |
capacity()
|
void |
clear()
|
java.lang.Object |
clone()
|
private boolean |
contains(java.util.Map.Entry entry)
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
protected FHashMap.Element |
createElement(int hash,
java.lang.Object key,
java.lang.Object value,
FHashMap.Element nextKey)
Use createElement(...) instead of new Element(...)
because so subclasses can change the default element-class easier |
protected FHashMap.Element |
createElement(int hash,
java.lang.Object key,
java.lang.Object value,
FHashMap.Element nextKey,
FHashMap.Element nextElem,
FHashMap.Element prevElem)
Use createElement(...) instead of new Element(...)
because so subclasses can change the default element-class easier |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
float |
loadFactor()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map map)
|
private void |
readObject(java.io.ObjectInputStream in)
|
private void |
rehash()
Rehashes the contents of this map into a new HashMap instance
with a larger capacity. |
private boolean |
remove(java.util.Map.Entry entry)
|
java.lang.Object |
remove(java.lang.Object key)
|
private void |
removeElementFromList(FHashMap.Element elem)
Removes the element elem from the linked list. |
int |
size()
|
private static boolean |
valEquals(java.lang.Object o1,
java.lang.Object o2)
|
java.util.Collection |
values()
|
private void |
writeObject(java.io.ObjectOutputStream out)
|
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
table
private transient FHashMap.Element[] table
size
private transient int size
clearCount
private transient int clearCount
threshold
private int threshold
- The table is rehashed when its size exceeds this threshold. (The
value of this field is (int)(capacity * loadFactor).)
loadFactor
private float loadFactor
- The load factor for the hashtable.
header
private transient FHashMap.Element header
- the header element for the linked list, which contains all
elements in the hash table. We need this list to iterate
threadsafe over the element of this hashmap
keySet
private transient java.util.Set keySet
valuesCollection
private transient java.util.Collection valuesCollection
entrySet
private transient java.util.Set entrySet
FHashMap
public FHashMap()
FHashMap
public FHashMap(int initialCapacity)
FHashMap
public FHashMap(java.util.Map map)
FHashMap
public FHashMap(int initialCapacity,
float loadFactor)
clone
public java.lang.Object clone()
- Overrides:
clone in class java.lang.Object
size
public int size()
- Specified by:
size in interface java.util.Map- Overrides:
size in class java.util.AbstractMap
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Map- Overrides:
isEmpty in class java.util.AbstractMap
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue in interface java.util.Map- Overrides:
containsValue in class java.util.AbstractMap
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey in interface java.util.Map- Overrides:
containsKey in class java.util.AbstractMap
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get in interface java.util.Map- Overrides:
get in class java.util.AbstractMap
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 java.util.AbstractMap
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
remove in interface java.util.Map- Overrides:
remove in class java.util.AbstractMap
putAll
public void putAll(java.util.Map map)
- Specified by:
putAll in interface java.util.Map- Overrides:
putAll in class java.util.AbstractMap
clear
public void clear()
- Specified by:
clear in interface java.util.Map- Overrides:
clear in class java.util.AbstractMap
keySet
public java.util.Set keySet()
- Specified by:
keySet in interface java.util.Map- Overrides:
keySet in class java.util.AbstractMap
values
public java.util.Collection values()
- Specified by:
values in interface java.util.Map- Overrides:
values in class java.util.AbstractMap
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet in interface java.util.Map- Overrides:
entrySet in class java.util.AbstractMap
createElement
protected FHashMap.Element createElement(int hash,
java.lang.Object key,
java.lang.Object value,
FHashMap.Element nextKey)
- Use
createElement(...) instead of new Element(...)
because so subclasses can change the default element-class easier
createElement
protected FHashMap.Element createElement(int hash,
java.lang.Object key,
java.lang.Object value,
FHashMap.Element nextKey,
FHashMap.Element nextElem,
FHashMap.Element prevElem)
- Use
createElement(...) instead of new Element(...)
because so subclasses can change the default element-class easier
rehash
private final void rehash()
- Rehashes the contents of this map into a new HashMap instance
with a larger capacity. This method is called automatically when the
number of keys in this map exceeds its capacity and load factor.
contains
private final boolean contains(java.util.Map.Entry entry)
remove
private final boolean remove(java.util.Map.Entry entry)
valEquals
private static final boolean valEquals(java.lang.Object o1,
java.lang.Object o2)
addElementToList
private final void addElementToList(FHashMap.Element elem)
- Adds an element before header in the linked list.
removeElementFromList
private final void removeElementFromList(FHashMap.Element elem)
- Removes the element elem from the linked list.
writeObject
private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException
readObject
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
capacity
public int capacity()
loadFactor
public float loadFactor()