|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gate.util.SimpleMapImpl
Implements Map interface in using less memory. Very simple but usefull for small number of items on it.
Inner Class Summary | |
private static class |
SimpleMapImpl.Entry
Auxiliary classes needed for the support of entrySet() method |
Inner classes inherited from class java.util.Map |
Map.Entry |
Field Summary | |
(package private) int |
capacity
The capacity of the map |
(package private) int |
count
The current number of elements of the map |
(package private) static Object |
nullKey
the Object instance that will represent the NULL keys in the map |
(package private) static long |
serialVersionUID
Freeze the serialization UID. |
(package private) Object[] |
theKeys
Array keeping the keys of the entries in the map. |
static HashMap |
theKeysHere
the static 'all keys' collection |
(package private) Object[] |
theValues
Array keeping the values of the entries in the map. |
Constructor Summary | |
SimpleMapImpl()
Constructor |
Method Summary | |
(package private) static void |
additional static members initialization |
void |
clear()
clear the map |
Object |
clone()
Create a copy of the map including the data. |
boolean |
containsKey(Object key)
return true if the key is in the map |
boolean |
containsValue(Object value)
return true if the map contains that value |
Set |
entrySet()
|
boolean |
equals(Object o)
|
Object |
get(Object key)
return the value associated with the key. |
private int |
getPostionByKey(Object key)
return positive value as index of the key in the map. |
private int |
getPostionByValue(Object value)
return positive value as index of the value in the map. |
protected int |
getSubsumeKey(Object key)
return the index of the key in the map comparing them by reference only. |
int |
hashCode()
return the hashCode for the map |
private void |
increaseCapacity()
|
boolean |
isEmpty()
return true if there are no elements in the map |
Set |
keySet()
return the set of the keys in the map. |
Object |
put(Object key,
Object value)
put a value in the map using the given key. |
void |
putAll(Map t)
put all the elements from a map |
private void |
readObject(ObjectInputStream s)
readObject - calls the default readObject() and then initialises the transient data |
Object |
remove(Object key)
remove value from the map using it's key. |
int |
size()
return the number of elements in the map |
String |
toString()
|
Collection |
values()
Not supported. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
int capacity
int count
Object[] theKeys
Object[] theValues
static final long serialVersionUID
static transient Object nullKey
public static transient HashMap theKeysHere
Constructor Detail |
public SimpleMapImpl()
Method Detail |
static void()
public int size()
size
in interface Map
public boolean isEmpty()
isEmpty
in interface Map
public Collection values()
values
in interface Map
public Set keySet()
keySet
in interface Map
public void clear()
clear
in interface Map
public boolean containsKey(Object key)
containsKey
in interface Map
public boolean containsValue(Object value)
containsValue
in interface Map
public Object get(Object key)
get
in interface Map
public Object put(Object key, Object value)
put
in interface Map
public Object remove(Object key)
remove
in interface Map
public void putAll(Map t)
putAll
in interface Map
private int getPostionByKey(Object key)
protected int getSubsumeKey(Object key)
private int getPostionByValue(Object value)
private void increaseCapacity()
public Set entrySet()
entrySet
in interface Map
public boolean equals(Object o)
equals
in interface Map
equals
in class Object
public int hashCode()
hashCode
in interface Map
hashCode
in class Object
public Object clone()
clone
in class Object
public String toString()
toString
in class Object
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |