edu.rice.cs.plt.collect
Class UnionMap<K,V>

java.lang.Object
  extended by edu.rice.cs.plt.collect.AbstractKeyBasedMap<K,V>
      extended by edu.rice.cs.plt.collect.UnionMap<K,V>
All Implemented Interfaces:
LambdaMap<K,V>, Lambda<K,V>, Composite, Serializable, Map<K,V>

public class UnionMap<K,V>
extends AbstractKeyBasedMap<K,V>
implements Composite, Serializable

A lazily-constructed and dynamically-updated union of two maps. The first is designated the parent, and the second the child. Bindings for keys in the child shadow those in the parent.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.plt.collect.AbstractKeyBasedMap
AbstractKeyBasedMap.EntrySet
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
UnionMap(Map<? extends K,? extends V> parent, Map<? extends K,? extends V> child)
           
 
Method Summary
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
 V get(Object key)
           
 PredicateSet<K> keySet()
           
 
Methods inherited from class edu.rice.cs.plt.collect.AbstractKeyBasedMap
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, mapEntryForKey, put, putAll, remove, size, toString, value, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnionMap

public UnionMap(Map<? extends K,? extends V> parent,
                Map<? extends K,? extends V> child)
Method Detail

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

get

public V get(Object key)
Specified by:
get in interface Map<K,V>
Specified by:
get in class AbstractKeyBasedMap<K,V>

keySet

public PredicateSet<K> keySet()
Specified by:
keySet in interface LambdaMap<K,V>
Specified by:
keySet in interface Map<K,V>
Specified by:
keySet in class AbstractKeyBasedMap<K,V>