| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.massimo.utils.HierarchicalMap<V>
V - public class HierarchicalMap<V>
A simple heirachical Map implementation. The key must be a String. Each instance can access but not modify it's parent's entries. Any parent entries are considered part of the hierarchical Map for the purpose of size, isEmpty(), contains, and for key, entry and value collections. However, put, remove and clear act on the current, internal Map instance only. The optional name is provided to help identify levels and nodes of the hierarchy.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface java.util.Map | 
|---|
| Map.Entry<K,V> | 
| Field Summary | |
|---|---|
| protected  String | nameAn optional instance name | 
| protected  Map<String,V> | nodeA Map for this level of the context heirachy | 
| protected  Map<String,V> | parentThe parent level of the context heirachy. | 
| Constructor Summary | |
|---|---|
| HierarchicalMap(int initialCapacity,
                Map<String,V> parent) | |
| HierarchicalMap(Map<String,V> parent) | |
| HierarchicalMap(String name,
                boolean caseSensitive,
                int initialCapacity,
                Map<String,V> parent) | |
| HierarchicalMap(String name,
                boolean caseSensitive,
                Map<String,V> parent) | |
| HierarchicalMap(String name,
                int initialCapacity,
                Map<String,V> parent) | |
| HierarchicalMap(String name,
                Map<String,V> parent) | |
| Method Summary | |
|---|---|
|  void | clear()Implement Map Removes all mappings from this node. | 
|  boolean | containsKey(Object key)Implement Map | 
|  boolean | containsValue(Object value)Implement Map | 
|  Set<Map.Entry<String,V>> | entrySet()Implement Map | 
|  boolean | equals(Object o)Implement Map | 
|  V | get(Object key)Implement Map | 
|  V | getLocal(Object key)As for Map.get(Object) but only look at the current leaf node. | 
|  String | getName() | 
|  Map<String,V> | getParent() | 
|  int | hashCode()Override Object This implementation iterates over entrySet(), calling hashCode on each element (entry) in the Collection, and adding up the results. | 
|  boolean | isEmpty()Implement Map | 
|  Set<String> | keySet()Implement Map | 
|  V | put(String key,
    V value)Implement Map | 
|  void | putAll(Map<? extends String,? extends V> t)Implement Map | 
|  V | remove(Object key)Implement Map | 
|  int | size()Implement Map | 
|  String | toString()Override Object | 
|  Collection<V> | values()Implement Map | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected String name
protected Map<String,V> node
protected Map<String,V> parent
| Constructor Detail | 
|---|
public HierarchicalMap(int initialCapacity,
                       Map<String,V> parent)
initialCapacity - The initial capacity of the level's Mapparent - Parent context Map. This will often be a HierarchicalMap.public HierarchicalMap(Map<String,V> parent)
parent - Parent context Map. This will often be a HierarchicalMap.
public HierarchicalMap(String name,
                       boolean caseSensitive,
                       int initialCapacity,
                       Map<String,V> parent)
name - Optional instance namecaseSensitive - Should this Map be case sensitive?initialCapacity - The initial capacity of the level's Mapparent - Parent context Map. This will often be a HierarchicalMap.
public HierarchicalMap(String name,
                       boolean caseSensitive,
                       Map<String,V> parent)
name - Pptional instance namecaseSensitive - parent - Parent context Map. This will often be a HierarchicalMap.
public HierarchicalMap(String name,
                       int initialCapacity,
                       Map<String,V> parent)
name - Pptional instance nameinitialCapacity - The initial capacity of the level's Mapparent - Parent context Map. This will often be a HierarchicalMap.
public HierarchicalMap(String name,
                       Map<String,V> parent)
name - Pptional instance nameparent - Parent context Map. This will often be a HierarchicalMap.| Method Detail | 
|---|
public void clear()
clear in interface Map<String,V>public boolean containsKey(Object key)
containsKey in interface Map<String,V>key - key whose presence in this map is to be tested.
NullPointerException - if the key is null and this map
           does not not permit null keys (optional).public boolean containsValue(Object value)
containsValue in interface Map<String,V>value - value whose presence in this map is to be tested.
NullPointerException - if the value is null and this map
           does not not permit null values (optional).public Set<Map.Entry<String,V>> entrySet()
entrySet in interface Map<String,V>public boolean equals(Object o)
equals in interface Map<String,V>equals in class Objecto - object to be compared for equality with this map.
public V get(Object key)
get in interface Map<String,V>key - key whose associated value is to be returned.
NullPointerException - key is null and this map does not
           not permit null keys (optional).get(Object)public V getLocal(Object key)
key - key whose associated value is to be returned.
NullPointerException - key is null and this map does not
           not permit null keys (optional).public String getName()
public Map<String,V> getParent()
public int hashCode()
hashCode in interface Map<String,V>hashCode in class Objectpublic boolean isEmpty()
isEmpty in interface Map<String,V>public Set<String> keySet()
keySet in interface Map<String,V>
public V put(String key,
             V value)
put in interface Map<String,V>key - key with which the specified value is to be associated.value - value to be associated with the specified key.
UnsupportedOperationException - if the put operation is
           not supported by this map.
ClassCastException - if the class of the specified key or value
           prevents it from being stored in this map.
IllegalArgumentException - if some aspect of this key or value
           prevents it from being stored in this map.
NullPointerException - this map does not permit null keys
           or values, and the specified key or value is null.public void putAll(Map<? extends String,? extends V> t)
putAll in interface Map<String,V>t - Mappings to be stored in this map.
UnsupportedOperationException - if the putAll method is
           not supported by this map.
ClassCastException - if the class of a key or value in the specified
           map prevents it from being stored in this map.
IllegalArgumentException - some aspect of a key or value in the
           specified map prevents it from being stored in this map.
NullPointerException - the specified map is null, or if
           this map does not permit null keys or values, and the
           specified map contains null keys or values.public V remove(Object key)
remove in interface Map<String,V>key - key whose mapping is to be removed from the map.
ClassCastException - if the key is of an inappropriate type for this
           map (optional).
NullPointerException - if the key is null and this map
           does not not permit null keys (optional).
UnsupportedOperationException - if the remove method is
           not supported by this map.public int size()
size in interface Map<String,V>public String toString()
toString in class Objectpublic Collection<V> values()
values in interface Map<String,V>| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||