Class JDFAttributeMapArray

    • Constructor Detail

      • JDFAttributeMapArray

        public JDFAttributeMapArray()
        constructor
      • JDFAttributeMapArray

        public JDFAttributeMapArray​(java.util.Collection<JDFAttributeMap> toAdd)
        copy constructor, the map elements are cloned
        Parameters:
        toAdd - Vector of elements to clone
      • JDFAttributeMapArray

        public JDFAttributeMapArray​(JDFAttributeMap[] toAdd)
        constructor from array, the map elements are not cloned
        Parameters:
        toAdd - the array
      • JDFAttributeMapArray

        public JDFAttributeMapArray​(JDFAttributeMap moreMap)
        Parameters:
        moreMap - the single attribute map to add
    • Method Detail

      • toString

        public java.lang.String toString()
        toString
        Overrides:
        toString in class java.util.AbstractCollection<JDFAttributeMap>
        Returns:
        String
      • isEmpty

        public static boolean isEmpty​(java.util.Collection<JDFAttributeMap> v)
        are we null or empty or contain only an empty JDFAttributeMap
        Parameters:
        v -
        Returns:
      • showKeys

        public java.lang.String showKeys​(java.lang.String sepMap,
                                         java.lang.String sepEntry)
        Parameters:
        sepMap - the separator between maps
        sepEntry - the separator between map entries
        Returns:
        the string representation
      • getPartValues

        public java.util.List<java.lang.String> getPartValues​(java.lang.String strKey,
                                                              boolean bUnique)
        Parameters:
        strKey - the attribute to get values from
        bUnique - if true, ensure unique vector, else the vector corresponds to the vector of values
        Returns:
        the Vector of all values
      • getAndMaps

        public JDFAttributeMapArray getAndMaps​(JDFAttributeMap map)
        andMap - builds a new vector of maps with identical pairs of both maps does not modify this
        Parameters:
        map - the given map
        Returns:
        the anded map, null if mismatches occurred
      • getOrMaps

        public JDFAttributeMapArray getOrMaps​(JDFAttributeMap map)
        andMap - builds a new vector of maps with identical pairs of both maps does not modify this
        Parameters:
        map - the given map
        Returns:
        the anded map, null if mismatches occurred
      • getOrMaps

        public JDFAttributeMapArray getOrMaps​(java.util.Collection<JDFAttributeMap> vMap)
        andMap - builds a new vector of maps with identical pairs of both maps does not modify this
        Parameters:
        map - the given map
        Returns:
        the anded map, null if mismatches occurred
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Parameters:
        key - the key to check for
        Returns:
        true if any of the maps contains key
        See Also:
        Map.containsKey(java.lang.Object)
      • maxSize

        public int maxSize()
        Return the maximum size size of a JDFAttributeMap in this
        Returns:
        int - the size
      • minSize

        public int minSize()
        Return the minimum size size of a JDFAttributeMap in this
        Returns:
        int - the size
      • get

        public JDFAttributeMap get​(int i)
        Returns the element at the given position (may be<0 to count backwards)
        Specified by:
        get in interface java.util.List<JDFAttributeMap>
        Overrides:
        get in class java.util.ArrayList<JDFAttributeMap>
        Parameters:
        i - the given position
        Returns:
        JDFAttributeMap - the selected element
      • removeKeys

        public JDFAttributeMapArray removeKeys​(java.util.Collection<java.lang.String> set)
        remove the keys specified in set and then erase any duplicates and emptys
        Parameters:
        set -
      • removeKey

        public JDFAttributeMapArray removeKey​(java.lang.String key)
        remove the key specified and then erase any duplicates and emptys
        Parameters:
        key -
      • reduceMap

        public void reduceMap​(java.util.Collection<java.lang.String> keySet)
        reduce each JDFAttributeMap in this by keySet (only entries in keyset are retained)
        Parameters:
        keySet -
      • getKeys

        public StringArray getKeys()
        return list of all keys
        Returns:
        the vector of all keys
      • getCommonMap

        public JDFAttributeMap 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
      • unify

        public void unify()
        unify - make VElement unique, retaining initial order
      • appendUnique

        public void appendUnique​(JDFAttributeMap map)
        Parameters:
        map - map to append
      • appendUnique

        public void appendUnique​(JDFAttributeMapArray maps)
        Method appendUnique.
        Parameters:
        maps - maps to append
      • overlapMap

        public JDFAttributeMapArray overlapMap​(JDFAttributeMap map)
        Method overlapMap. removes all non-overlapping maps from this
        Parameters:
        map - the map to check against
        Returns:
      • getOverlapMaps

        public JDFAttributeMapArray getOverlapMaps​(JDFAttributeMap map)
        Method overlapMap. get a copy of this with all overlapping maps the maps are NOT cloned
        Parameters:
        map - the map to check against
        Returns:
        a new VJDFAttributemap with the overlapping entries of this - never null
      • getMatchingMaps

        public JDFAttributeMapArray getMatchingMaps​(java.lang.String key,
                                                    java.lang.String regExp,
                                                    boolean ignoreCase)
        Method overlapMap. get a copy of this with all matching maps the maps are NOT cloned
        Parameters:
        key - the key to match
        regExp - the simplified regexp
        ignoreCase - duh...
        Returns:
        a new VJDFAttributemap with the matching entries of this - never null (may be safely daisy-chained)
      • overlapMap

        public JDFAttributeMapArray overlapMap​(JDFAttributeMapArray vMap)
        Method overlapMap. only entries that contain at least one matching map entry are retained
        Parameters:
        vMap - the map to check against
      • overlapsMap

        public boolean overlapsMap​(JDFAttributeMap map)
        Method overlapMap.
        Parameters:
        map - the map to check against
        Returns:
      • subMap

        public boolean subMap​(JDFAttributeMap map)
        Method subMap.
        Parameters:
        map - the submap to check against
        Returns:
        true if this has at least one entry that subMap is a submap of
      • subMap

        public boolean subMap​(java.util.Collection<JDFAttributeMap> vMap)
        Method subMap.
        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
      • overlapsMap

        public boolean overlapsMap​(java.util.Collection<JDFAttributeMap> vMap)
        Method overlapsMap. returns true if at least one element exists that has no non-matching key value pairs
        Parameters:
        vMap - the vector to check against
        Returns:
        true if this has at least one entry that vMap contains at least a submap of
      • equals

        public boolean equals​(java.lang.Object other)
        equals - Compares two map vectors, returns true if content equal regardless of element order, otherwise false.
        If input is not of type VJDFAttributeMap, result of superclasses equals method is returned.
        Specified by:
        equals in interface java.util.Collection<JDFAttributeMap>
        Specified by:
        equals in interface java.util.List<JDFAttributeMap>
        Overrides:
        equals in class java.util.ArrayList<JDFAttributeMap>
        Parameters:
        other - in this case VJDFAttributeMap to compare
        Returns:
        boolean - true if the maps are equal, otherwise false
      • extendMap

        public void extendMap​(java.lang.String strKey,
                              java.util.Collection<java.lang.String> vsValues)
        replace all maps in this with n maps that have the values strKey, vsValues
        Parameters:
        strKey - the new key to add
        vsValues - String of values
      • put

        public void put​(java.lang.Object key,
                        java.lang.Object value)
        put the key value pair into all entries
        Parameters:
        key - the key to set - may be either String or Enum
        value - the value to set - may be either String or Enum
        Throws:
        java.lang.IllegalArgumentException - if key or value have the wrong type
      • hashCode

        public int hashCode()
        hashCode complements equals() to fulfill the equals/hashCode contract
        Specified by:
        hashCode in interface java.util.Collection<JDFAttributeMap>
        Specified by:
        hashCode in interface java.util.List<JDFAttributeMap>
        Overrides:
        hashCode in class java.util.ArrayList<JDFAttributeMap>
        Returns:
        int
      • put

        public void put​(java.lang.String key,
                        java.lang.String value)
        put the key value pair into all entries; if no entries are there, create exactly one entry with the given key value pair
        Parameters:
        key - the key to set
        value - the value to set
      • removeMaps

        public void removeMaps​(JDFAttributeMap map)
        remove all matching maps from this i.e. if map is subMap of this
        Parameters:
        map -
      • put

        public void put​(JDFAttributeMap commonMap)
        put the value of all keys into every existing map
        Parameters:
        commonMap -