org.cip4.jdflib.datatypes
Class JDFAttributeMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,String>
          extended by org.cip4.jdflib.datatypes.JDFAttributeMap
All Implemented Interfaces:
Serializable, Cloneable, Map<String,String>

public class JDFAttributeMap
extends HashMap<String,String>

This is the Java class to the mAttribute class on the C++ side.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
JDFAttributeMap()
          constructor
JDFAttributeMap(Map<String,String> inputMap)
          Method JDFAttributeMap clone the content of the input map
JDFAttributeMap(String key, String value)
          utility constructor to construct a single value map
JDFAttributeMap(String key, org.apache.commons.lang.enums.ValuedEnum value)
          utility constructor to construct a single value map
JDFAttributeMap(org.apache.commons.lang.enums.ValuedEnum partIDKey, String value)
          constructor: create a new map with one entry that is defined by partIDKey, value
 
Method Summary
 void andMap(JDFAttributeMap subMap)
          andMap - builds a new map with identical pairs of both maps
 JDFAttributeMap clone()
           
 String get(Object key)
           
 JDFAttributeMap getAndMap(JDFAttributeMap subMap)
          andMap - builds a new map with identical pairs of both maps does not modify this
 Iterator<String> getKeyIterator()
          getKeyIterator - returns an iterator over the elements in this set.
 VString getKeys()
          get the keys as a Vector,
 JDFAttributeMap getOrMap(JDFAttributeMap subMap)
          andMap - builds a new map with identical pairs of both maps does not modify this
 Enumeration<String> keys()
          Deprecated. use keyset().iterator()
 JDFAttributeMap orMap(JDFAttributeMap subMap)
          orMap - put all key/value pairs which are not in this map to this map.
 boolean overlapMap(JDFAttributeMap subMap)
          overlapMap - identical keys must have the same values in both maps i.e submap is either a superset or a subset of this
 boolean overlapMap(VJDFAttributeMap vMap)
          Method overlapMap.
 String put(String key, String value)
          put - maps the specified key to the specified value in this hashtable. the key MUST NOT be "" Note: This method is the equivalent to AddPair in C++
 String put(String key, org.apache.commons.lang.enums.ValuedEnum value)
           
 String put(org.apache.commons.lang.enums.ValuedEnum key, String value)
           
 String put(org.apache.commons.lang.enums.ValuedEnum key, org.apache.commons.lang.enums.ValuedEnum value)
           
 String putNotNull(Object key, Object value)
          put - maps the specified key to the specified value in this hashtable.
 JDFAttributeMap reduceMap(Collection<String> keySet)
          reduceKey - reduces the map, only valid map entries with the given key vector will be copied to the new hashtable; if null, clear this map
 String remove(Object key)
          remove - removes the key (and its corresponding value) from this hashtable.
 JDFAttributeMap removeKeys(Collection<String> set)
          remove all keys defined by set from this
 String showKeys(String sep)
          showKeys - similar to toString but without class identifier
 boolean subMap(JDFAttributeMap subMap)
          subMap - returns true if map contains subMap, all keys of submap must be in this hashtable and they must have the same value
if subMap is null, the function returns true if subMap contains any wildcards, then the existance of the key in this defines a match
 boolean subMap(VJDFAttributeMap vMap)
          Method subMap check if any of the maps in vMap are a subMap oft this (see subMap for details) if vMap is null, the function returns true
 String toString()
          toString
 
Methods inherited from class java.util.HashMap
clear, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, 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

JDFAttributeMap

public JDFAttributeMap()
constructor


JDFAttributeMap

public JDFAttributeMap(String key,
                       String value)
utility constructor to construct a single value map

Parameters:
key - the key of the single value map
value - the value of the single value map

JDFAttributeMap

public JDFAttributeMap(String key,
                       org.apache.commons.lang.enums.ValuedEnum value)
utility constructor to construct a single value map

Parameters:
key - the key of the single value map
value - the value of the single value map

JDFAttributeMap

public JDFAttributeMap(Map<String,String> inputMap)
Method JDFAttributeMap clone the content of the input map

Parameters:
inputMap - map to clone

JDFAttributeMap

public JDFAttributeMap(org.apache.commons.lang.enums.ValuedEnum partIDKey,
                       String value)
constructor: create a new map with one entry that is defined by partIDKey, value

Parameters:
partIDKey - the enumerated partIDKey
value - the partition key value
Method Detail

showKeys

public String showKeys(String sep)
showKeys - similar to toString but without class identifier

Parameters:
sep - the separator key between key-entry pairs
Returns:
String

keys

@Deprecated
public Enumeration<String> keys()
Deprecated. use keyset().iterator()

keys - returns an enumeration of all keys in this JDFAttributeMap

Returns:
Enumeration - the enumeration of all keys

toString

public String toString()
toString

Overrides:
toString in class AbstractMap<String,String>
Returns:
String

put

public String put(String key,
                  String value)
put - maps the specified key to the specified value in this hashtable. the key MUST NOT be "" Note: This method is the equivalent to AddPair in C++

Specified by:
put in interface Map<String,String>
Overrides:
put in class HashMap<String,String>
Parameters:
key - unique key of the pair to add. Must not be "" or null.
value - value of the pair to add. MAY be "" or null.
Returns:
boolean - false if one Inputparamter is invalid (empty String and null are not alowed)
true if the new Key was inserted

NOTE: It is NOT possible to enter to identical keys. If you enter a key to a Attribute Map which already exists, the value will be replaced.


putNotNull

public String putNotNull(Object key,
                         Object value)
put - maps the specified key to the specified value in this hashtable. Neither the key nor the value can be "" Note: This method is the equivalent to AddPair in C++

Parameters:
key - unique key of the pair to add. Must not be "" or null.
value - value of the pair to add. Must not be "" or null.
Returns:
boolean - false if one Inputparamter is invalid (empty String and null are not alowed)
true if the new Key was inserted

NOTE: It is NOT possible to enter to identical keys. If you enter a key to a Attribute Map which already exists, the value will be replaced.


subMap

public boolean subMap(JDFAttributeMap subMap)
subMap - returns true if map contains subMap, all keys of submap must be in this hashtable and they must have the same value
if subMap is null, the function returns true if subMap contains any wildcards, then the existance of the key in this defines a match

Parameters:
subMap - the map to compare
Returns:
boolean - true if this map contains subMap

subMap

public boolean subMap(VJDFAttributeMap vMap)
Method subMap check if any of the maps in vMap are a subMap oft this (see subMap for details) if vMap is null, the function returns true

Parameters:
vMap - the vector submaps to check against
Returns:
true if this has at least one entry that vMap contains at least a submap of

overlapMap

public boolean overlapMap(VJDFAttributeMap vMap)
Method overlapMap.

Parameters:
vMap - the vector submaps to check against
Returns:
true if this has at least one entry that vMap contains at least a submap or supermap of

overlapMap

public boolean overlapMap(JDFAttributeMap subMap)
overlapMap - identical keys must have the same values in both maps i.e submap is either a superset or a subset of this

Parameters:
subMap - the map to compare with this
Returns:
boolean - true if identical keys have the same values in both maps

orMap

public JDFAttributeMap orMap(JDFAttributeMap subMap)
orMap - put all key/value pairs which are not in this map to this map. Clear this, if both maps have the same keys with different values.

Parameters:
subMap - the map to compare with this
Returns:

andMap

public void andMap(JDFAttributeMap subMap)
andMap - builds a new map with identical pairs of both maps

Parameters:
subMap - the given map

getOrMap

public JDFAttributeMap getOrMap(JDFAttributeMap subMap)
andMap - builds a new map with identical pairs of both maps does not modify this

Parameters:
subMap - the given map
Returns:
the ored map, null if mismatches occurred

getAndMap

public JDFAttributeMap getAndMap(JDFAttributeMap subMap)
andMap - builds a new map with identical pairs of both maps does not modify this

Parameters:
subMap - the given map
Returns:
the anded map, null if mismatches occurred

reduceMap

public JDFAttributeMap reduceMap(Collection<String> keySet)
reduceKey - reduces the map, only valid map entries with the given key vector will be copied to the new hashtable; if null, clear this map

Parameters:
keySet - the collection of given keys
Returns:
this after removal

remove

public String remove(Object key)
remove - removes the key (and its corresponding value) from this hashtable.
This method does nothing if the key is not in the hashtable

Specified by:
remove in interface Map<String,String>
Overrides:
remove in class HashMap<String,String>
Returns:
Object - the value to which the key had been mapped in this hashtable, or null if the key did not have a mapping

get

public String get(Object key)
Specified by:
get in interface Map<String,String>
Overrides:
get in class HashMap<String,String>
See Also:
Map.get(java.lang.Object)

put

public String put(org.apache.commons.lang.enums.ValuedEnum key,
                  String value)
Parameters:
key -
value -
Returns:

put

public String put(String key,
                  org.apache.commons.lang.enums.ValuedEnum value)
Parameters:
key -
value -
Returns:

put

public String put(org.apache.commons.lang.enums.ValuedEnum key,
                  org.apache.commons.lang.enums.ValuedEnum value)
Parameters:
key -
value -
Returns:

getKeyIterator

public Iterator<String> getKeyIterator()
getKeyIterator - returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:
Iterator - an iterator over the elements in this set

getKeys

public VString getKeys()
get the keys as a Vector,

Returns:

removeKeys

public JDFAttributeMap removeKeys(Collection<String> set)
remove all keys defined by set from this

Parameters:
set - the set of keys ot remove
Returns:
this map

clone

public JDFAttributeMap clone()
Overrides:
clone in class HashMap<String,String>
Returns:
See Also:
Object.clone()


Copyright © 2013. All Rights Reserved.