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

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

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

The transitive composition of two maps, lazily constructed and dynamically-updated. An entry k=v appears in the map if and only if there is an entry k=x in the first map and x=v in the second.

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
ComposedMap(Map<? extends K,? extends X> map1, Map<? super X,? extends V> map2)
           
 
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

ComposedMap

public ComposedMap(Map<? extends K,? extends X> map1,
                   Map<? super X,? extends V> map2)
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>