Class JDFAttributeMap

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.String>

    public class JDFAttributeMap
    extends java.util.HashMap<java.lang.String,​java.lang.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

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      JDFAttributeMap()
      constructor
      JDFAttributeMap​(java.lang.String key, java.lang.String value)
      utility constructor to construct a single value map
      JDFAttributeMap​(java.lang.String key, org.apache.commons.lang.enums.ValuedEnum value)
      utility constructor to construct a single value map
      JDFAttributeMap​(java.util.Map<java.lang.String,​java.lang.String> inputMap)
      Method JDFAttributeMap clone the content of the input map
      JDFAttributeMap​(org.apache.commons.lang.enums.ValuedEnum partIDKey, java.lang.String value)
      constructor: create a new map with one entry that is defined by partIDKey, value
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void andMap​(JDFAttributeMap subMap)
      andMap - builds a new map with identical pairs of both maps
      JDFAttributeMap clone()  
      boolean containsAny​(VString keys)  
      java.lang.String get​(java.lang.Object key)  
      JDFAttributeMap getAndMap​(JDFAttributeMap subMap)
      andMap - builds a new map with identical pairs of both maps does not modify this
      boolean getBool​(java.lang.Object key, boolean def)
      convenience boolean getter
      JDFAttributeMap getCommonMap​(JDFAttributeMap other)
      return the map that is common to all elements of this.
      double getDouble​(java.lang.Object key, double def)
      convenience double getter
      java.lang.String getIgnoreCase​(java.lang.String strLocalName)  
      int getInt​(java.lang.Object key, int def)
      convenience int getter
      java.util.Iterator<java.lang.String> getKeyIterator()
      getKeyIterator - returns an iterator over the elements in this set.
      StringArray getKeyList()
      get the keys as a Vector,
      VString getKeys()
      Deprecated.
      use getKeyList
      java.lang.String getNonEmpty​(java.lang.Object key)
      get but always return null instead of empty string
      JDFAttributeMap getOrMap​(JDFAttributeMap subMap)
      orMap - builds a new map with identical pairs of both maps does not modify this
      static boolean isEmpty​(JDFAttributeMap jdfAttributeMap)  
      java.util.Enumeration<java.lang.String> keys()
      Deprecated.
      use keyset().iterator()
      boolean matches​(java.lang.String key, java.lang.String regExp, boolean ignoreCase)
      checks whether this attributemap matches a regexp
      JDFAttributeMap orMap​(JDFAttributeMap subMap)
      orMap - put all key/value pairs which are not in this map to this map.
      boolean overlapMap​(java.util.Collection<JDFAttributeMap> vMap)
      Method overlapMap.
      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)  
      boolean overlapsMap​(java.util.Collection<JDFAttributeMap> vMap)
      Method overlapMap.
      boolean overlapsMap​(VJDFAttributeMap vMap)  
      java.lang.String put​(java.lang.String key, boolean value)  
      java.lang.String put​(java.lang.String key, double value)  
      java.lang.String put​(java.lang.String key, int value)  
      java.lang.String put​(java.lang.String key, java.lang.String value)
      put - maps the specified key to the specified value in this hashtable.
      java.lang.String put​(java.lang.String key, org.apache.commons.lang.enums.ValuedEnum value)  
      java.lang.String put​(org.apache.commons.lang.enums.ValuedEnum key, boolean value)  
      java.lang.String put​(org.apache.commons.lang.enums.ValuedEnum key, double value)  
      java.lang.String put​(org.apache.commons.lang.enums.ValuedEnum key, int value)  
      java.lang.String put​(org.apache.commons.lang.enums.ValuedEnum key, java.lang.String value)  
      java.lang.String put​(org.apache.commons.lang.enums.ValuedEnum key, org.apache.commons.lang.enums.ValuedEnum value)  
      java.lang.String putNotNull​(java.lang.Object key, java.lang.Object value)
      put - maps the specified key to the specified value in this hashtable.
      JDFAttributeMap reduceMap​(java.util.Collection<java.lang.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
      java.lang.String remove​(java.lang.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
      void removeEmpty()  
      JDFAttributeMap removeKeys​(java.util.Collection<java.lang.String> toRemove)
      remove all keys defined by set from this
      java.lang.String renameKey​(java.lang.String oldKey, java.lang.String newKey)
      rename a key to the new value.
      java.lang.String showKeys​(java.lang.String sep)
      showKeys - similar to toString but without class identifier
      boolean subMap​(java.util.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 true
      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)  
      java.lang.String toString()
      toString
      • Methods 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, 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​(java.lang.String key,
                               java.lang.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​(java.lang.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​(java.util.Map<java.lang.String,​java.lang.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,
                               java.lang.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 java.lang.String showKeys​(java.lang.String sep)
        showKeys - similar to toString but without class identifier
        Parameters:
        sep - the separator key between key-entry pairs
        Returns:
        String
      • keys

        @Deprecated
        public java.util.Enumeration<java.lang.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 java.lang.String toString()
        toString
        Overrides:
        toString in class java.util.AbstractMap<java.lang.String,​java.lang.String>
        Returns:
        String
      • put

        public java.lang.String put​(java.lang.String key,
                                    java.lang.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 java.util.Map<java.lang.String,​java.lang.String>
        Overrides:
        put in class java.util.HashMap<java.lang.String,​java.lang.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

        public java.lang.String putNotNull​(java.lang.Object key,
                                           java.lang.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​(java.util.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 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​(java.util.Collection<JDFAttributeMap> 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
      • overlapsMap

        public boolean overlapsMap​(java.util.Collection<JDFAttributeMap> 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
      • matches

        public boolean matches​(java.lang.String key,
                               java.lang.String regExp,
                               boolean ignoreCase)
        checks whether this attributemap matches a regexp
        Parameters:
        key - the key to match
        regExp - the simplified regexp
        ignoreCase - duh...
        Returns:
        true if the value matches the regexp
      • 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)
        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

        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
      • getCommonMap

        public JDFAttributeMap getCommonMap​(JDFAttributeMap other)
        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

        public JDFAttributeMap reduceMap​(java.util.Collection<java.lang.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 java.lang.String remove​(java.lang.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 java.util.Map<java.lang.String,​java.lang.String>
        Overrides:
        remove in class java.util.HashMap<java.lang.String,​java.lang.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
      • renameKey

        public java.lang.String renameKey​(java.lang.String oldKey,
                                          java.lang.String newKey)
        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

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

        public boolean containsAny​(VString keys)
        Parameters:
        keys -
        Returns:
      • removeEmpty

        public void removeEmpty()
        Parameters:
        keys -
      • getNonEmpty

        public java.lang.String getNonEmpty​(java.lang.Object key)
        get but always return null instead of empty string
      • getInt

        public int getInt​(java.lang.Object key,
                          int def)
        convenience int getter
        Parameters:
        key -
        def -
        Returns:
      • getBool

        public boolean getBool​(java.lang.Object key,
                               boolean def)
        convenience boolean getter
        Parameters:
        key -
        def -
        Returns:
      • getDouble

        public double getDouble​(java.lang.Object key,
                                double def)
        convenience double getter
        Parameters:
        key -
        def -
        Returns:
      • put

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

        public java.lang.String put​(java.lang.String key,
                                    int value)
        Parameters:
        key -
        value -
        Returns:
      • put

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

        public java.lang.String put​(java.lang.String key,
                                    double value)
        Parameters:
        key -
        value -
        Returns:
      • put

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

        public java.lang.String put​(java.lang.String key,
                                    boolean value)
        Parameters:
        key -
        value -
        Returns:
      • put

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

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

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

        public java.util.Iterator<java.lang.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

        @Deprecated
        public VString getKeys()
        Deprecated.
        use getKeyList
        get the keys as a Vector,
        Returns:
      • getKeyList

        public StringArray getKeyList()
        get the keys as a Vector,
        Returns:
      • removeKeys

        public JDFAttributeMap removeKeys​(java.util.Collection<java.lang.String> toRemove)
        remove all keys defined by set from this
        Parameters:
        toRemove - the set of keys to remove
        Returns:
        this map
      • clone

        public JDFAttributeMap clone()
        Overrides:
        clone in class java.util.HashMap<java.lang.String,​java.lang.String>
        Returns:
        See Also:
        Object.clone()
      • isEmpty

        public static boolean isEmpty​(JDFAttributeMap jdfAttributeMap)
        Parameters:
        jdfAttributeMap -
        Returns:
        true if jdfAttributeMap==null or jdfAttributeMap is empty
      • getIgnoreCase

        public java.lang.String getIgnoreCase​(java.lang.String strLocalName)
        Parameters:
        strLocalName -
        Returns: