de.grogra.util
Class ConfigurationSet

java.lang.Object
  extended by de.grogra.util.ConfigurationSet
All Implemented Interfaces:
Map, ModifiableMap

public final class ConfigurationSet
extends java.lang.Object
implements ModifiableMap

A ConfigurationSet is a ModifiableMap and consists of a set of Configurations. The map associations are the union of the associations of the individual configurations.

Author:
Ole Kniemeyer

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.grogra.util.ModifiableMap
ModifiableMap.Producer
 
Nested classes/interfaces inherited from interface de.grogra.util.Map
Map.Chain
 
Field Summary
 
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
 
Constructor Summary
ConfigurationSet(java.lang.String name)
          Creates a new configuration set with the given name.
 
Method Summary
 void add(Configurable c)
          Adds the configurations of c to this set by invoking Configurable.addConfigurations(ConfigurationSet) on c.
 void add(Configuration c)
          Adds c to this set.
 java.lang.Object get(java.lang.Object key, java.lang.Object defaultValue)
          Returns the value associated with key.
 KeyDescription[] getKeyDescriptions()
          Returns the union of the KeyDescriptions of the contained configurations.
 java.lang.String getName()
          Returns the name of this set.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps key to value.
 int size()
          Returns the number of configurations.
 void writeBack()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationSet

public ConfigurationSet(java.lang.String name)
Creates a new configuration set with the given name.

Parameters:
name - the name for this set
Method Detail

add

public void add(Configurable c)
Adds the configurations of c to this set by invoking Configurable.addConfigurations(ConfigurationSet) on c. If this method is invoke more than once with the same c, only the first invocation has an effect.

Parameters:
c - a configurable object

add

public void add(Configuration c)
Adds c to this set.

Parameters:
c - the configuration to be added

get

public java.lang.Object get(java.lang.Object key,
                            java.lang.Object defaultValue)
Description copied from interface: Map
Returns the value associated with key. If there is no value associated with key, defaultValue is returned.

Specified by:
get in interface Map
Parameters:
key - a key for the map
defaultValue - the default value
Returns:
the associated value, or defaultValue

getKeyDescriptions

public KeyDescription[] getKeyDescriptions()
Returns the union of the KeyDescriptions of the contained configurations.

Returns:
the descriptions for all keys of this set

getName

public java.lang.String getName()
Returns the name of this set.

Returns:
the name

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from interface: ModifiableMap
Maps key to value. Following invocations of the get-method with key as key will return value.

Specified by:
put in interface ModifiableMap
Parameters:
key - a key
value - the value to be associated with key
Returns:
the previously associated value, or null

size

public int size()
Returns the number of configurations.

Returns:
number of configurations

writeBack

public void writeBack()