gate.util
Class SimpleMapImpl

java.lang.Object
  |
  +--gate.util.SimpleMapImpl
All Implemented Interfaces:
Cloneable, Map, Serializable
Direct Known Subclasses:
SimpleFeatureMapImpl

class SimpleMapImpl
extends Object
implements Map, Cloneable, Serializable

Implements Map interface in using less memory. Very simple but usefull for small number of items on it.

See Also:
Serialized Form

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)  Object g_akey
           
(package private)  int m_capacity
          The capacity of the map
(package private)  Object[] m_keys
          Array keeping the keys of the entries in the map.
(package private)  int m_size
          The current number of elements of the map
(package private)  Object[] m_values
          Array keeping the values of the entries in 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.
static HashMap theKeysHere
           
 
Constructor Summary
SimpleMapImpl()
           
 
Method Summary
(package private) static void ()
           
 void clear()
           
 Object clone()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object o)
           
 Object get(Object key)
           
private  int getPostionByKey(Object key)
           
private  int getPostionByValue(Object value)
           
protected  int getSubsumeKey(Object key)
           
 int hashCode()
           
private  void increaseCapacity()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
           
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_capacity

int m_capacity
The capacity of the map

m_size

int m_size
The current number of elements of the map

m_keys

Object[] m_keys
Array keeping the keys of the entries in the map. It is "synchrnized" with the m_values array - the Nth position in both arrays correspond to one and the same entry

m_values

Object[] m_values
Array keeping the values of the entries in the map. It is "synchrnized" with the m_keys array - the Nth position in both arrays correspond to one and the same entry

g_akey

transient Object g_akey

serialVersionUID

static final long serialVersionUID
Freeze the serialization UID.

nullKey

static transient Object nullKey
the Object instance that will represent the NULL keys in the map

theKeysHere

public static transient HashMap theKeysHere
Constructor Detail

SimpleMapImpl

public SimpleMapImpl()
Method Detail

size

public int size()
Specified by:
size in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

values

public Collection values()
Specified by:
values in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

getPostionByKey

private int getPostionByKey(Object key)

getSubsumeKey

protected int getSubsumeKey(Object key)

getPostionByValue

private int getPostionByValue(Object value)

increaseCapacity

private void increaseCapacity()

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

equals

public boolean equals(Object o)
Specified by:
equals in interface Map
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

clone

public Object clone()
Overrides:
clone in class Object

toString

public String toString()
Overrides:
toString in class Object

static void ()