net.sf.molae.pipe.trafo
Class KeyTransformedMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--net.sf.molae.pipe.basic.AbstractMapWithSet
              |
              +--net.sf.molae.pipe.trafo.EntryTransformedMap
                    |
                    +--net.sf.molae.pipe.trafo.KeyTransformedMap
All Implemented Interfaces:
Map

public final class KeyTransformedMap
extends EntryTransformedMap

Provides a different view to an existing map by transforming the key of every entry.

Since:
1.1

Inner classes inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet
AbstractMapWithSet.EntrySet
 
Inner classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
KeyTransformedMap(Map base, Transformer transformer)
          Constructs a KeyTransformedMap object.
 
Method Summary
 boolean containsKey(Object key)
          Returns true if the base map contains a mapping with a key that would transform into the specified key.
 boolean containsValue(Object value)
           
 Object get(Object key)
           
 Set keySet()
          Returns a set view of the keys contained in this map.
 Object put(Object key, Object value)
           
 Object remove(Object key)
           
 Collection values()
           
 
Methods inherited from class net.sf.molae.pipe.trafo.EntryTransformedMap
clear, getEntrySetIterator, getTransformer, size
 
Methods inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet
entrySet
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, putAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyTransformedMap

public KeyTransformedMap(Map base,
                         Transformer transformer)
Constructs a KeyTransformedMap object.
Parameters:
base - the underlying map
transformer - the transformer that maps each key to another one
Throws:
NullPointerException - if any of the specified objects is null.
Method Detail

containsKey

public boolean containsKey(Object key)
Returns true if the base map contains a mapping with a key that would transform into the specified key.
Overrides:
containsKey in class AbstractMap
Parameters:
key - key whose presence in this map is to be tested
Returns:
true if the base map contains a mapping with a key that would transform into the specified element.

containsValue

public boolean containsValue(Object value)
Overrides:
containsValue in class AbstractMap

get

public Object get(Object key)
Overrides:
get in class AbstractMap

put

public Object put(Object key,
                  Object value)
Overrides:
put in class AbstractMap

remove

public Object remove(Object key)
Overrides:
remove in class AbstractMap

keySet

public Set keySet()
Description copied from class: AbstractMapWithSet
Returns a set view of the keys contained in this map. This implementation returns a typesafe version of the key set from AbstractMap
Overrides:
keySet in class AbstractMapWithSet
Following copied from class: net.sf.molae.pipe.basic.AbstractMapWithSet
Returns:
a set view of the keys contained in this map.

values

public Collection values()
Overrides:
values in class AbstractMap