com.j2r
Class ManagedMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.HashMap
          extended by com.j2r.ManagedMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class ManagedMap
extends java.util.HashMap

See Also:
Serialized Form

Constructor Summary
ManagedMap(int size)
          Creates a new instance with the specified storage.
 
Method Summary
 void clear()
          Clears all elements.
 java.lang.Object clone()
          Creates a shallow copy of this object, preserving the internal structure by copying only references.
 java.lang.Object get(int index)
          Returns the key at the specified index.
 MapManagerStrategy getMapManagerStrategy()
           
 java.lang.Object getValue(int index)
          Returns the value at the specified index.
 int indexOf(java.lang.Object key)
          Returns the index of the specified key.
 java.util.Iterator iterator()
          Returns a key iterator.
 int lastIndexOf(java.lang.Object key)
          Returns the last index of the specified key.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Stores the provided key/value pair.
 void putAll(java.util.Map t)
          Stores the provided key/value pairs.
 java.lang.Object remove(java.lang.Object key)
          Removes the element with the specified key.
 void setMapManagerStrategy(MapManagerStrategy newMapManagerStrategy)
           
 
Methods inherited from class java.util.HashMap
containsKey, containsValue, entrySet, get, isEmpty, keySet, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ManagedMap

public ManagedMap(int size)
Creates a new instance with the specified storage. When the map size is growing to be bigger then the given size the first in element will be first out so that the size never gets bigger then the given size.

Parameters:
size - The storage to allocate up front.
Method Detail

clear

public void clear()
Clears all elements.

Specified by:
clear in interface java.util.Map
Overrides:
clear in class java.util.HashMap

clone

public java.lang.Object clone()
Creates a shallow copy of this object, preserving the internal structure by copying only references. The keys, values, and sequence are not clone()'d.

Overrides:
clone in class java.util.HashMap
Returns:
A clone of this instance.

get

public java.lang.Object get(int index)
Returns the key at the specified index.


getValue

public java.lang.Object getValue(int index)
Returns the value at the specified index.


indexOf

public int indexOf(java.lang.Object key)
Returns the index of the specified key.


iterator

public java.util.Iterator iterator()
Returns a key iterator.


lastIndexOf

public int lastIndexOf(java.lang.Object key)
Returns the last index of the specified key.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Stores the provided key/value pair. Freshens the sequence of existing elements.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap
Parameters:
key - The key to the provided value.
value - The value to store.
Returns:
The previous value for the specified key, or null if none.

putAll

public void putAll(java.util.Map t)
Stores the provided key/value pairs.

Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class java.util.HashMap
Parameters:
t - The key/value pairs to store.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the element with the specified key.

Specified by:
remove in interface java.util.Map
Overrides:
remove in class java.util.HashMap
Parameters:
key - The Map key of the object to remove.
Returns:
The previous value coressponding the key, or null if none existed.

getMapManagerStrategy

public MapManagerStrategy getMapManagerStrategy()

setMapManagerStrategy

public void setMapManagerStrategy(MapManagerStrategy newMapManagerStrategy)