Package org.cip4.jdflib.datatypes
Class JDFAttributeMap
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,String>
This is the Java class to the mAttribute class on the C++ side.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionconstructorJDFAttributeMap(String key, String value) utility constructor to construct a single value mapJDFAttributeMap(String key, ValuedEnum value) utility constructor to construct a single value mapJDFAttributeMap(Map<String, String> inputMap) Method JDFAttributeMap clone the content of the input mapJDFAttributeMap(ValuedEnum partIDKey, String value) constructor: create a new map with one entry that is defined by partIDKey, value -
Method Summary
Modifier and TypeMethodDescriptionvoidandMap(JDFAttributeMap subMap) andMap - builds a new map with identical pairs of both mapsclone()booleancontainsAny(VString keys) getAndMap(JDFAttributeMap subMap) andMap - builds a new map with identical pairs of both maps does not modify thisbooleanconvenience boolean gettergetCommonMap(JDFAttributeMap other) return the map that is common to all elements of this.doubleconvenience double gettergetIgnoreCase(String strLocalName) intconvenience int gettergetKeyIterator - returns an iterator over the elements in this set.get the keys as a Vector,getKeys()Deprecated.use getKeyListgetNonEmpty(Object key) get but always return null instead of empty stringgetOrMap(JDFAttributeMap subMap) orMap - builds a new map with identical pairs of both maps does not modify thisstatic booleanisEmpty(JDFAttributeMap jdfAttributeMap) keys()Deprecated.use keyset().iterator()booleanchecks whether this attributemap matches a regexporMap(JDFAttributeMap subMap) orMap - put all key/value pairs which are not in this map to this map.booleanoverlapMap(Collection<JDFAttributeMap> vMap) Method overlapMap.booleanoverlapMap(JDFAttributeMap subMap) overlapMap - identical keys must have the same values in both maps i.e submap is either a superset or a subset of thisbooleanoverlapMap(VJDFAttributeMap vMap) booleanoverlapsMap(Collection<JDFAttributeMap> vMap) Method overlapMap.booleanoverlapsMap(VJDFAttributeMap vMap) put - maps the specified key to the specified value in this hashtable.put(String key, ValuedEnum value) put(ValuedEnum key, boolean value) put(ValuedEnum key, double value) put(ValuedEnum key, int value) put(ValuedEnum key, String value) put(ValuedEnum key, ValuedEnum value) putNotNull(Object key, Object value) put - maps the specified key to the specified value in this hashtable.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 mapremove - removes the key (and its corresponding value) from this hashtable.
This method does nothing if the key is not in the hashtablevoidremoveKeys(Collection<String> toRemove) remove all keys defined by set from thisrename a key to the new value.showKeys - similar to toString but without class identifierstatic StringshowKeys(JDFAttributeMap map, String sep) booleansubMap(Collection<JDFAttributeMap> 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 truebooleansubMap(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 matchbooleansubMap(VJDFAttributeMap vMap) toString()toStringMethods inherited from class java.util.HashMap
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode
-
Constructor Details
-
JDFAttributeMap
public JDFAttributeMap()constructor -
JDFAttributeMap
utility constructor to construct a single value map- Parameters:
key- the key of the single value mapvalue- the value of the single value map
-
JDFAttributeMap
utility constructor to construct a single value map- Parameters:
key- the key of the single value mapvalue- the value of the single value map
-
JDFAttributeMap
Method JDFAttributeMap clone the content of the input map- Parameters:
inputMap- map to clone
-
JDFAttributeMap
constructor: create a new map with one entry that is defined by partIDKey, value- Parameters:
partIDKey- the enumerated partIDKeyvalue- the partition key value
-
-
Method Details
-
showKeys
showKeys - similar to toString but without class identifier- Parameters:
sep- the separator key between key-entry pairs- Returns:
- String
-
keys
Deprecated.use keyset().iterator()keys - returns an enumeration of all keys in thisJDFAttributeMap- Returns:
- Enumeration - the enumeration of all keys
-
toString
toString- Overrides:
toStringin classAbstractMap<String,String> - Returns:
- String
-
put
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:
putin interfaceMap<String,String> - Overrides:
putin classHashMap<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:
- the previous value of oldkey, if any
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
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 insertedNOTE: 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
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
-
subMap
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
-
overlapMap
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
-
overlapsMap
-
overlapsMap
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
-
matches
checks whether this attributemap matches a regexp- Parameters:
key- the key to matchregExp- the simplified regexpignoreCase- duh...- Returns:
- true if the value matches the regexp
-
overlapMap
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 withthis- Returns:
- boolean - true if identical keys have the same values in both maps
-
orMap
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 withthis- Returns:
-
andMap
andMap - builds a new map with identical pairs of both maps- Parameters:
subMap- the given map
-
getOrMap
orMap - 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
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
-
getCommonMap
return the map that is common to all elements of this. All keys exist and have the same value- Returns:
- the vector of all keys
-
reduceMap
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
remove - removes the key (and its corresponding value) from this hashtable.
This method does nothing if the key is not in the hashtable -
renameKey
rename a key to the new value. newKey is only replaced if oldkey exists and is non empty- Parameters:
oldKey-newKey-- Returns:
- the previous value of oldkey
-
get
-
containsAny
- Parameters:
keys-- Returns:
-
removeEmpty
public void removeEmpty()- Parameters:
keys-
-
getNonEmpty
get but always return null instead of empty string -
getInt
convenience int getter- Parameters:
key-def-- Returns:
-
getBool
convenience boolean getter- Parameters:
key-def-- Returns:
-
getDouble
convenience double getter- Parameters:
key-def-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
-
put
- Parameters:
key-value-- Returns:
-
put
- Parameters:
key-value-- Returns:
-
put
-
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
Deprecated.use getKeyListget the keys as a Vector,- Returns:
-
getKeyList
get the keys as a Vector,- Returns:
-
removeKeys
remove all keys defined by set from this- Parameters:
toRemove- the set of keys to remove- Returns:
- this map
-
clone
-
showKeys
-
isEmpty
- Parameters:
jdfAttributeMap-- Returns:
- true if jdfAttributeMap==null or jdfAttributeMap is empty
-
getIgnoreCase
- Parameters:
strLocalName-- Returns:
-