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

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

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

A map whose value set is translated by a mapping lambda.

See Also:
MappedIterable, ComposedMap, 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
MappedMap(Map<K,? extends X> map, Lambda<? super X,? extends V> lambda)
           
 
Method Summary
 void clear()
          Throws an UnsupportedOperationException.
 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.
 boolean containsKey(Object o)
          Returns keySet().contains(key).
 V get(Object key)
           
 boolean isEmpty()
          Returns keySet().isEmpty().
 PredicateSet<K> keySet()
           
 V remove(Object key)
          Throws an UnsupportedOperationException.
 int size()
          Returns keySet().size().
 Collection<V> values()
          Return a collection backed by IterUtil.map(keySet(), this).
 
Methods inherited from class edu.rice.cs.plt.collect.AbstractKeyBasedMap
containsValue, entrySet, equals, hashCode, mapEntryForKey, put, putAll, toString, value
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MappedMap

public MappedMap(Map<K,? extends X> map,
                 Lambda<? super X,? extends V> lambda)
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>

remove

public V remove(Object key)
Description copied from class: AbstractKeyBasedMap
Throws an UnsupportedOperationException.

Specified by:
remove in interface Map<K,V>
Overrides:
remove in class AbstractKeyBasedMap<K,V>

clear

public void clear()
Description copied from class: AbstractKeyBasedMap
Throws an UnsupportedOperationException.

Specified by:
clear in interface Map<K,V>
Overrides:
clear in class AbstractKeyBasedMap<K,V>

size

public int size()
Description copied from class: AbstractKeyBasedMap
Returns keySet().size().

Specified by:
size in interface Map<K,V>
Overrides:
size in class AbstractKeyBasedMap<K,V>

isEmpty

public boolean isEmpty()
Description copied from class: AbstractKeyBasedMap
Returns keySet().isEmpty().

Specified by:
isEmpty in interface Map<K,V>
Overrides:
isEmpty in class AbstractKeyBasedMap<K,V>

containsKey

public boolean containsKey(Object o)
Description copied from class: AbstractKeyBasedMap
Returns keySet().contains(key).

Specified by:
containsKey in interface Map<K,V>
Overrides:
containsKey in class AbstractKeyBasedMap<K,V>

values

public Collection<V> values()
Description copied from class: AbstractKeyBasedMap
Return a collection backed by IterUtil.map(keySet(), this).

Specified by:
values in interface Map<K,V>
Overrides:
values in class AbstractKeyBasedMap<K,V>