Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.collections
Class TransformingMap<OK,OV,IK,IV>

    java.lang.Object
      java.util.AbstractMap<OK,OV>
          umontreal.iro.lecuyer.collections.TransformingMap<OK,OV,IK,IV>

Type Parameters:
  `OK` - the type of the outer keys
  `OV` - the type of the outer values
  `IK` - the type of the inner keys
  `IV` - the type of the inner values

All Implemented Interfaces:
  Map<OK,OV>

    public abstract class TransformingMap<OK,OV,IK,IV>

extends AbstractMap<OK,OV>

Represents a map that dynamically transforms the elements of another map. This abstract class defines a map containing an inner map of elements with certain key and value types, and provides facilities to convert keys and values to outer other types. A concrete subclass simply needs to provide methods for converting keys and values between the inner and the outer types. The mapping established for the keys by these methods must be one-to-one. Otherwise, the size of the outer map might be incorrect, and the iterators may give the same entry multiple times. Also, a `null` key or value should always correspond to a `null` element.

Nested Class Summary

Nested classes/interfaces inherited from class java.util.AbstractMap
`AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

Nested classes/interfaces inherited from interface java.util.Map
`Map.Entry<K,V>`

Constructor Summary
`TransformingMap(Map<IK,IV> innerMap)` Constructs a new transforming map converting keys and values of map `innerMap`.

Method Summary
`void` | `clear()`
`boolean` | `containsKey(Object key)`
`boolean` | `containsValue(Object value)`
`abstract OK` | `convertKeyFromInnerType(IK key)` Converts the key for the inner map to a key for the outer map.
`abstract IK` | `convertKeyToInnerType(OK key)` Converts the key for the outer map to a key for the inner map.
`abstract OV` | `convertValueFromInnerType(IV value)` Converts the value for the inner map to a value for the outer map.
`abstract IV` | `convertValueToInnerType(OV value)` Converts the value for the outer map to a value for the inner map.
`Set<Map.Entry<OK,OV>>` | `entrySet()`
`OV` | `get(Object key)`
`Map<IK,IV>` | `getInnerMap()` Returns the inner map associated with this map.
`boolean` | `isEmpty()`
`Set<OK>` | `keySet()`
`OV` | `put(OK key, OV value)`
`OV` | `remove(Object key)`
`int` | `size()`
`Collection<OV>` | `values()`

Methods inherited from class java.util.AbstractMap
`clone, equals, hashCode, putAll, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TransformingMap

    public TransformingMap(Map<IK,IV> innerMap)

  Constructs a new transforming map converting keys and values of map `innerMap`.

  Parameters:
    `innerMap` - the inner map.
  Throws:
    `NullPointerException` - if `innerMap` is `null`.

Method Detail

### getInnerMap

    public Map<IK,IV> getInnerMap()

  Returns the inner map associated with this map.

  Returns:
    the inner map.

### convertKeyFromInnerType

    public abstract OK convertKeyFromInnerType(IK key)

  Converts the key for the inner map to a key for the outer map.

  Parameters:
    `key` - the inner key.
  Returns:
    the outer key.

### convertKeyToInnerType

    public abstract IK convertKeyToInnerType(OK key)

  Converts the key for the outer map to a key for the inner map.

  Parameters:
    `key` - the outer key.
  Returns:
    the inner key.

### convertValueFromInnerType

    public abstract OV convertValueFromInnerType(IV value)

  Converts the value for the inner map to a value for the outer map.

  Parameters:
    `value` - the inner value.
  Returns:
    the outer value.

### convertValueToInnerType

    public abstract IV convertValueToInnerType(OV value)

  Converts the value for the outer map to a value for the inner map.

  Parameters:
    `value` - the outer value.
  Returns:
    the inner value.

### clear

    public void clear()

  Specified by:
    `clear` in interface `Map<OK,OV>`
  Overrides:
    `clear` in class `AbstractMap<OK,OV>`

### containsKey

    public boolean containsKey(Object key)

  Specified by:
    `containsKey` in interface `Map<OK,OV>`
  Overrides:
    `containsKey` in class `AbstractMap<OK,OV>`

### containsValue

    public boolean containsValue(Object value)

  Specified by:
    `containsValue` in interface `Map<OK,OV>`
  Overrides:
    `containsValue` in class `AbstractMap<OK,OV>`

### entrySet

    public Set<Map.Entry<OK,OV>> entrySet()

  Specified by:
    `entrySet` in interface `Map<OK,OV>`
  Specified by:
    `entrySet` in class `AbstractMap<OK,OV>`

### keySet

    public Set<OK> keySet()

  Specified by:
    `keySet` in interface `Map<OK,OV>`
  Overrides:
    `keySet` in class `AbstractMap<OK,OV>`

### values

    public Collection<OV> values()

  Specified by:
    `values` in interface `Map<OK,OV>`
  Overrides:
    `values` in class `AbstractMap<OK,OV>`

### get

    public OV get(Object key)

  Specified by:
    `get` in interface `Map<OK,OV>`
  Overrides:
    `get` in class `AbstractMap<OK,OV>`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Map<OK,OV>`
  Overrides:
    `isEmpty` in class `AbstractMap<OK,OV>`

### put

    public OV put(OK key,
                  OV value)

  Specified by:
    `put` in interface `Map<OK,OV>`
  Overrides:
    `put` in class `AbstractMap<OK,OV>`

### remove

    public OV remove(Object key)

  Specified by:
    `remove` in interface `Map<OK,OV>`
  Overrides:
    `remove` in class `AbstractMap<OK,OV>`

### size

    public int size()

  Specified by:
    `size` in interface `Map<OK,OV>`
  Overrides:
    `size` in class `AbstractMap<OK,OV>`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.