com.rubecula.util
Class AlphabeticalMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended bycom.rubecula.util.StringMap
              extended bycom.rubecula.util.AlphabeticalMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable
Direct Known Subclasses:
AttrMap

public class AlphabeticalMap
extends StringMap

Class to define an alphabetical map, that is to say a Map where the keys are case-insensitive Strings and where the values are Strings.

Since:
V_0_3
Version:
$Revision: 1.5 $
Author:
Robin Hillyard
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
AlphabeticalMap()
          Construct an empty AlphabeticalMap
 
Method Summary
 boolean contains(java.lang.String key)
          Method to determine if this map contains entry for key (key is case-insensitive).
 java.lang.Object get(java.lang.String key)
          Method to get the entry for key (key is case-insensitive).
 AlphabeticalMap merge(AlphabeticalMap other)
          Method to merge this AttrMap with other such that the attributes in this take precedence.
 java.lang.Object put(java.lang.String key, java.lang.String value)
          Method to add an entry to the map.
 java.lang.String toString()
          Yield a string representation of this MapUtils.
 
Methods inherited from class com.rubecula.util.StringMap
get, put, put
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

AlphabeticalMap

public AlphabeticalMap()
Construct an empty AlphabeticalMap

See Also:
HashMap.HashMap()
Method Detail

get

public java.lang.Object get(java.lang.String key)
Method to get the entry for key (key is case-insensitive).

Overrides:
get in class StringMap
Parameters:
key - the key to the entry being sought.
Returns:
true if map contains the attribute defined by key.
See Also:
Map.get(java.lang.Object)

contains

public boolean contains(java.lang.String key)
Method to determine if this map contains entry for key (key is case-insensitive).

Parameters:
key - the attribute being sought.
Returns:
true if map contains the attribute defined by key.

put

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

Method to add an entry to the map.

Note that this method has to be declared thus (not with key as a String) if it is to be called in place of the superclass method. Polymorphism seems to work that way.

Parameters:
key - the key (a String) to the entry being added (key is case-insensitive).
value - either null (for the default) or the entry's value as a String.
Returns:
true if map contains the entry defined by key.

merge

public AlphabeticalMap merge(AlphabeticalMap other)
Method to merge this AttrMap with other such that the attributes in this take precedence.

Parameters:
other - the subservient attribute map to be merge into this.
Returns:
the merged attribute map.

toString

public java.lang.String toString()
Yield a string representation of this MapUtils.

Returns:
a String in the form: {attribute,attribute,...,attribute} where attribute is of form: name[=value] (where the [=value] is optional).