com.timeindexing.util
Class CascadingMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by com.timeindexing.util.CascadingMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map
Direct Known Subclasses:
IndexProperties

public class CascadingMap
extends java.util.HashMap
implements java.util.Map

A cascading map is a map that holds its own map data, and also references a submap which also holds map data. A cascade of cascading maps can hold more than one version of a key in the individual maps. Any key in a map will supercede the same key in a submap. Keys will be found by traversing as many submaps as is necessary. The first one found will end the traversal.

Most of the methods of Map only work on this CascadingMap, they do not operate on submaps. Submaps appear to be read-only.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
CascadingMap()
          A constructor.
CascadingMap(CascadingMap aSubMap)
          A constructor which specifies a submap
CascadingMap(java.util.Map map)
          Construct a CascadingMap using a Map object.
CascadingMap(java.util.Properties properties)
          Construct a CascadingMap using a Properties object.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Does the casacading map contain a key.
 int depth()
          How deep is the CascadingMap.
 java.lang.Object get(java.lang.Object key)
          Get a value from the casacading map for a key.
 CascadingMap getSubmap()
          Get the submap from this CascadingMap.
 boolean hasSubmap()
          Is there a submap from this CascadingMap.
 java.util.Set keySet()
          Get all the keys in the casacading map.
 
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, isEmpty, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsValue, entrySet, equals, hashCode, isEmpty, put, putAll, remove, size, values
 

Constructor Detail

CascadingMap

public CascadingMap()
A constructor.


CascadingMap

public CascadingMap(java.util.Properties properties)
Construct a CascadingMap using a Properties object. These mappings will have String objects.


CascadingMap

public CascadingMap(java.util.Map map)
Construct a CascadingMap using a Map object.


CascadingMap

public CascadingMap(CascadingMap aSubMap)
A constructor which specifies a submap

Parameters:
aSubMap - an existing CascadingMap which will be a submap to this CascadingMap
Method Detail

containsKey

public boolean containsKey(java.lang.Object key)
Does the casacading map contain a key.

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

get

public java.lang.Object get(java.lang.Object key)
Get a value from the casacading map for a key.

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

keySet

public java.util.Set keySet()
Get all the keys in the casacading map.

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

getSubmap

public CascadingMap getSubmap()
Get the submap from this CascadingMap.


hasSubmap

public boolean hasSubmap()
Is there a submap from this CascadingMap.


depth

public int depth()
How deep is the CascadingMap.



Timeindexing 2008