net.sf.molae.pipe.cube
Class MapTree<E,T>
java.lang.Object
java.util.AbstractMap<K,V>
net.sf.molae.pipe.basic.AbstractMapWithSet<List<E>,T>
net.sf.molae.pipe.cube.MapTree<E,T>
- All Implemented Interfaces:
- Map<List<E>,T>
public class MapTree<E,T>
- extends AbstractMapWithSet<List<E>,T>
A tree with named edges.
Every node is itself a map tree.
It consists of a value and a map to children nodes
where the key is the name of the edge and the value is the child node.
The map tree defines a new map of path/leaf pairs:
Each map entry in the new map corresponds to a (sub) map tree.
The key of the entry is the path to the leaf in form of a list of keys.
The value of the entry is the value of the leaf.
- Since:
- 1.1
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
MapTree
public MapTree()
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map<List<E>,T>
- Overrides:
containsKey
in class AbstractMap<List<E>,T>
get
public T get(Object key)
- Returns the value to which this map maps the specified key.
- Specified by:
get
in interface Map<List<E>,T>
- Overrides:
get
in class AbstractMap<List<E>,T>
- Parameters:
key
- a list of index values
- Returns:
- the value to which this map maps the specified key,
or
null
if the map contains no mapping for this key.
- Throws:
ClassCastException
- if the key is not a List
NullPointerException
- if the key is null
put
public T put(List<E> key,
T value)
- Associates the specified value with the specified key in this map.
- Specified by:
put
in interface Map<List<E>,T>
- Overrides:
put
in class AbstractMap<List<E>,T>
- Parameters:
key
- a list of index valuesvalue
- value to be associated with the specified key
- Returns:
- previous value associated with specified key
- Throws:
ClassCastException
- if the key is not a List
.
NullPointerException
- if the key is null
.
remove
public T remove(Object key)
- Specified by:
remove
in interface Map<List<E>,T>
- Overrides:
remove
in class AbstractMap<List<E>,T>
clear
public void clear()
- Specified by:
clear
in interface Map<List<E>,T>
- Overrides:
clear
in class AbstractMap<List<E>,T>
getEntrySetIterator
protected Iterator<Map.Entry<List<E>,T>> getEntrySetIterator()
- Description copied from class:
AbstractMapWithSet
- Returns the iterator of the entry set.
- Specified by:
getEntrySetIterator
in class AbstractMapWithSet<List<E>,T>
- Returns:
- the iterator of the entry set.