de.unidu.is.util
Class DelegatedPropertyMap

java.lang.Object
  extended byde.unidu.is.util.PropertyMap
      extended byde.unidu.is.util.DelegatedPropertyMap
All Implemented Interfaces:
java.util.Map
Direct Known Subclasses:
HashPropertyMap, StreamPropertyMap

public class DelegatedPropertyMap
extends PropertyMap

This class delegates all calls to another map. This map implementation can be initialised by another map. The keys of this initialisation map are stored separately, so that these entries can be distinguished from the "ordinary" entries lateron.

Since:
2003-06-20
Version:
$Revision: 1.11 $, $Date: 2005/03/14 17:33:13 $
Author:
Henrik Nottelmann

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  java.util.Set initKeys
          Set containing initial keys.
protected  java.util.Map map
          Map implementation to which all calls are delegated.
 
Fields inherited from class de.unidu.is.util.PropertyMap
multipleValues
 
Constructor Summary
DelegatedPropertyMap(java.util.Map map)
          Creates a new instance.
DelegatedPropertyMap(java.util.Map map, boolean multipleValues)
          Creates a new instance.
 
Method Summary
protected  void changed()
          Calls whenever the map is changed.
 void clear()
          Removes all entries.
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object get(java.lang.Object key)
           
 java.util.List getAll(java.lang.Object key)
          Returns a list with all values stored for the specified key.
 java.util.Set getInitKeys()
          Returns the initial keys.
 java.util.Map getMap()
          Returns the map to which calls are delegated.
 int hashCode()
           
 void init(java.util.Map init)
          Inits the map by setting the initial keys and values.
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object putInitial(java.lang.Object key, java.lang.Object value)
          Sets an initial value which can be distinguished from "ordinary" entries lateron.
 java.lang.Object putNoChange(java.lang.Object key, java.lang.Object value)
          Puts the (key,vaue) pair into the map without calling the changed() method.
 java.lang.Object remove(java.lang.Object key)
           
 void remove(java.lang.Object key, java.lang.Object value)
          Removes the specified value for the specified key.
 void setInitKeys(java.util.Set initKeys)
          Sets the initial keys.
 void setMap(java.util.Map map)
          Sets the map to which calls are delegated.
 int size()
           
 java.lang.String toString()
           
 java.util.Collection values()
           
 
Methods inherited from class de.unidu.is.util.PropertyMap
addDouble, addDouble, addDouble, addInt, addInt, addInt, apply, convertString, divDouble, divDouble, divDouble, divInt, divInt, divInt, getBoolean, getDouble, getInt, getLength, getLong, getMaxDouble, getMaxKey, getMinDouble, getString, getString, getSum, hasMultipleValues, inc, initDouble, isMultipleValues, multDouble, multDouble, multDouble, multDouble, multInt, multInt, multInt, normalizeLength, removeCloseToZero, removeZero, set, setBoolean, setDouble, setInt, setLong, setMultipleValues, setString, subDouble, subDouble, subDouble, subInt, subInt, subInt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

map

protected java.util.Map map
Map implementation to which all calls are delegated.


initKeys

protected java.util.Set initKeys
Set containing initial keys.

Constructor Detail

DelegatedPropertyMap

public DelegatedPropertyMap(java.util.Map map)
Creates a new instance.

Parameters:
map - to which calls are delegated

DelegatedPropertyMap

public DelegatedPropertyMap(java.util.Map map,
                            boolean multipleValues)
Creates a new instance.

Parameters:
map - to which calls are delegated
multipleValues - values if true, multiple values can be hold for a key
Method Detail

init

public void init(java.util.Map init)
Inits the map by setting the initial keys and values. These values are not original entries and can be distinguished lateron.

Parameters:
init - map for initialisation (may be null)

changed

protected void changed()
Calls whenever the map is changed.

Subclasses can override this method.


clear

public void clear()
Removes all entries.


containsKey

public boolean containsKey(java.lang.Object key)

containsValue

public boolean containsValue(java.lang.Object value)

entrySet

public java.util.Set entrySet()

equals

public boolean equals(java.lang.Object obj)

get

public java.lang.Object get(java.lang.Object key)

hashCode

public int hashCode()

isEmpty

public boolean isEmpty()

keySet

public java.util.Set keySet()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

putNoChange

public java.lang.Object putNoChange(java.lang.Object key,
                                    java.lang.Object value)
Puts the (key,vaue) pair into the map without calling the changed() method.

Parameters:
key - key
value - value for the key
Returns:
previous value

putInitial

public java.lang.Object putInitial(java.lang.Object key,
                                   java.lang.Object value)
Sets an initial value which can be distinguished from "ordinary" entries lateron.

Parameters:
key - entry key
value - entry value
Returns:
previous value associated with specified key, or null if no value is available

putAll

public void putAll(java.util.Map t)

remove

public java.lang.Object remove(java.lang.Object key)

size

public int size()

toString

public java.lang.String toString()

values

public java.util.Collection values()

getAll

public java.util.List getAll(java.lang.Object key)
Description copied from class: PropertyMap
Returns a list with all values stored for the specified key.

Specified by:
getAll in class PropertyMap
Parameters:
key - property key
Returns:
list with all values stored for the specified key

remove

public void remove(java.lang.Object key,
                   java.lang.Object value)
Description copied from class: PropertyMap
Removes the specified value for the specified key.

Specified by:
remove in class PropertyMap
Parameters:
key - property key
value - value to be removed

getMap

public java.util.Map getMap()
Returns the map to which calls are delegated.

Returns:
map to which calls are delegated

setMap

public void setMap(java.util.Map map)
Sets the map to which calls are delegated.

Parameters:
map - map to which calls are delegated

setInitKeys

public void setInitKeys(java.util.Set initKeys)
Sets the initial keys.

Parameters:
initKeys - initial keys

getInitKeys

public java.util.Set getInitKeys()
Returns the initial keys.

Returns:
set containing the initial keys