Package org.cip4.jdflib.datatypes
Class VJDFAttributeMap
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<JDFAttributeMap>
-
- org.cip4.jdflib.datatypes.VJDFAttributeMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<JDFAttributeMap>,java.util.Collection<JDFAttributeMap>,java.util.List<JDFAttributeMap>,java.util.RandomAccess
public class VJDFAttributeMap extends java.util.Vector<JDFAttributeMap>
Description: This class represents a vector of JDFAttributeMaps- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VJDFAttributeMap()constructorVJDFAttributeMap(java.util.Vector<JDFAttributeMap> toAdd)copy constructor, the map elements are clonedVJDFAttributeMap(JDFAttributeMap moreMap)VJDFAttributeMap(JDFAttributeMap[] toAdd)constructor from array, the map elements are not cloned
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddall(VJDFAttributeMap v)Deprecated.use addAllvoidaddElement(JDFAttributeMap map)voidappendUnique(JDFAttributeMap map)voidappendUnique(VJDFAttributeMap maps)Method appendUnique.VJDFAttributeMapclone()booleancontainsKey(java.lang.Object key)JDFAttributeMapelementAt(int i)Returns the element at the given positionbooleanequals(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.voidextendMap(java.lang.String strKey, java.util.List<java.lang.String> vsValues)replace all maps in this with n maps that have the values strKey, vsValuesJDFAttributeMapget(int i)Returns the element at the given position (may be<0 to count backwards)VJDFAttributeMapgetAndMaps(JDFAttributeMap map)andMap - builds a new vector of maps with identical pairs of both maps does not modify thisJDFAttributeMapgetCommonMap()return the map that is common to all elements of this.VStringgetKeys()return list of all keysVJDFAttributeMapgetMatchingMaps(java.lang.String key, java.lang.String regExp, boolean ignoreCase)Method overlapMap.static VJDFAttributeMapgetNonEmpty(VJDFAttributeMap v)VJDFAttributeMapgetOrMaps(JDFAttributeMap map)andMap - builds a new vector of maps with identical pairs of both maps does not modify thisVJDFAttributeMapgetOrMaps(VJDFAttributeMap vMap)andMap - builds a new vector of maps with identical pairs of both maps does not modify thisVJDFAttributeMapgetOverlapMaps(JDFAttributeMap map)Method overlapMap.VStringgetPartValues(java.lang.String strKey, boolean bUnique)java.util.Vector<JDFAttributeMap>getVector()Deprecated.- use thisstatic VJDFAttributeMapgetVector(JDFAttributeMap partMap)booleanhasEntryWithEqualKeyValuePairs(JDFAttributeMap attmap)Deprecated.use containsinthashCode()hashCode complements equals() to fulfill the equals/hashCode contractstatic booleanisEmpty(VJDFAttributeMap v)are we null or empty or contain only an empty JDFAttributeMapintmaxSize()Return the maximum size size of a JDFAttributeMap in thisintminSize()Return the minimum size size of a JDFAttributeMap in thisvoidoverlapMap(JDFAttributeMap map)Method overlapMap.voidoverlapMap(VJDFAttributeMap vMap)Method overlapMap.booleanoverlapsMap(JDFAttributeMap map)Method overlapMap.booleanoverlapsMap(VJDFAttributeMap vMap)Method overlapsMap.voidput(java.lang.Object key, java.lang.Object value)put the key value pair into all entriesvoidput(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 pairvoidput(JDFAttributeMap commonMap)put the value of all keys into every existing mapvoidreduceKey(java.util.Vector vKeys)Deprecated.use reduceMapvoidreduceMap(java.util.Collection<java.lang.String> keySet)reduce each JDFAttributeMap inthisby keySet (only entries in keyset are retained)voidremoveElementAt(int i)voidremoveKey(java.lang.String key)remove the key specified and then erase any duplicates and emptysvoidremoveKeys(java.util.Collection<java.lang.String> set)remove the keys specified in set and then erase any duplicates and emptysvoidremoveMaps(JDFAttributeMap map)remove all matching maps from this i.e.voidsetElementAt(JDFAttributeMap mTmp, int j)voidsetVector(java.util.List<JDFAttributeMap> vec)sets the Vector with JDFAttributeMap elementsjava.lang.StringshowKeys(java.lang.String sepMap, java.lang.String sepEntry)booleansubMap(JDFAttributeMap map)Method subMap.booleansubMap(VJDFAttributeMap vMap)Method subMap.java.lang.StringtoString()toStringvoidunify()unify - make VElement unique, retaining initial order-
Methods inherited from class java.util.Vector
add, add, addAll, addAll, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, forEach, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeIf, removeRange, replaceAll, retainAll, set, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Constructor Detail
-
VJDFAttributeMap
public VJDFAttributeMap()
constructor
-
VJDFAttributeMap
public VJDFAttributeMap(java.util.Vector<JDFAttributeMap> toAdd)
copy constructor, the map elements are cloned- Parameters:
toAdd- Vector of elements to clone
-
VJDFAttributeMap
public VJDFAttributeMap(JDFAttributeMap[] toAdd)
constructor from array, the map elements are not cloned- Parameters:
toAdd- the array
-
VJDFAttributeMap
public VJDFAttributeMap(JDFAttributeMap moreMap)
- Parameters:
moreMap- the single attribute map to add
-
-
Method Detail
-
toString
public java.lang.String toString()
toString- Overrides:
toStringin classjava.util.Vector<JDFAttributeMap>- Returns:
- String
-
getNonEmpty
public static VJDFAttributeMap getNonEmpty(VJDFAttributeMap v)
- Parameters:
v-- Returns:
-
getVector
public static VJDFAttributeMap getVector(JDFAttributeMap partMap)
- Parameters:
partMap-- Returns:
-
isEmpty
public static boolean isEmpty(VJDFAttributeMap 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 mapssepEntry- the separator between map entries- Returns:
- the string representation
-
getPartValues
public VString getPartValues(java.lang.String strKey, boolean bUnique)
- Parameters:
strKey- the attribute to get values frombUnique- if true, ensure unique vector, else the vector corresponds to the vector of values- Returns:
- the Vector of all values
-
extendMap
public void extendMap(java.lang.String strKey, java.util.List<java.lang.String> vsValues)replace all maps in this with n maps that have the values strKey, vsValues- Parameters:
strKey- the new key to addvsValues- String of values
-
getAndMaps
public VJDFAttributeMap 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 VJDFAttributeMap 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 VJDFAttributeMap getOrMaps(VJDFAttributeMap 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.Object key)
- Parameters:
key- the key to check for- Returns:
- true if any of the maps contains key
- See Also:
Map.containsKey(java.lang.Object)
-
setVector
public void setVector(java.util.List<JDFAttributeMap> vec)
sets the Vector with JDFAttributeMap elements- Parameters:
vec- the Vector with JDFAttributeMap elements
-
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
-
elementAt
public JDFAttributeMap elementAt(int i)
Returns the element at the given position- Overrides:
elementAtin classjava.util.Vector<JDFAttributeMap>- Parameters:
i- the given position (may be<0 to count backwards)- Returns:
- JDFAttributeMap - the selected element
-
get
public JDFAttributeMap get(int i)
Returns the element at the given position (may be<0 to count backwards)- Specified by:
getin interfacejava.util.List<JDFAttributeMap>- Overrides:
getin classjava.util.Vector<JDFAttributeMap>- Parameters:
i- the given position- Returns:
- JDFAttributeMap - the selected element
-
removeKeys
public void removeKeys(java.util.Collection<java.lang.String> set)
remove the keys specified in set and then erase any duplicates and emptys- Parameters:
set-
-
removeElementAt
public void removeElementAt(int i)
- Overrides:
removeElementAtin classjava.util.Vector<JDFAttributeMap>
-
removeKey
public void removeKey(java.lang.String key)
remove the key specified and then erase any duplicates and emptys- Parameters:
key-
-
hasEntryWithEqualKeyValuePairs
@Deprecated public boolean hasEntryWithEqualKeyValuePairs(JDFAttributeMap attmap)
Deprecated.use containsTests whether this has a entry with the same key and value entries not more nor less keys- Parameters:
attmap- the given JDFAttributeMap element- Returns:
- boolean - true if and only if the specified AttributeMap has the some number of keys and values and the same keys and values as a entry in this vector
-
reduceKey
@Deprecated public void reduceKey(java.util.Vector vKeys)
Deprecated.use reduceMap- Parameters:
vKeys-
-
reduceMap
public void reduceMap(java.util.Collection<java.lang.String> keySet)
reduce each JDFAttributeMap inthisby keySet (only entries in keyset are retained)- Parameters:
keySet-
-
getKeys
public VString getKeys()
return list of all keys- Returns:
- the vector of all keys
-
getVector
@Deprecated public java.util.Vector<JDFAttributeMap> getVector()
Deprecated.- use thisReturns the vector with JDFAttributeMap elements- Returns:
- Vector - the vector with JDFAttributeMap elements
-
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
-
appendUnique
public void appendUnique(JDFAttributeMap map)
- Parameters:
map- map to append
-
addElement
public void addElement(JDFAttributeMap map)
- Overrides:
addElementin classjava.util.Vector<JDFAttributeMap>
-
unify
public void unify()
unify - make VElement unique, retaining initial order
-
appendUnique
public void appendUnique(VJDFAttributeMap maps)
Method appendUnique.- Parameters:
maps- maps to append
-
addall
@Deprecated public void addall(VJDFAttributeMap v)
Deprecated.use addAlldeprecated legacy support- Parameters:
v-
-
overlapMap
public void overlapMap(JDFAttributeMap map)
Method overlapMap. removes all non-overlapping maps from this- Parameters:
map- the map to check against
-
getOverlapMaps
public VJDFAttributeMap 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 VJDFAttributeMap 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 matchregExp- the simplified regexpignoreCase- duh...- Returns:
- a new VJDFAttributemap with the matching entries of this - never null (may be safely daisy-chained)
-
overlapMap
public void overlapMap(VJDFAttributeMap 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(VJDFAttributeMap 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(VJDFAttributeMap 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:
equalsin interfacejava.util.Collection<JDFAttributeMap>- Specified by:
equalsin interfacejava.util.List<JDFAttributeMap>- Overrides:
equalsin classjava.util.Vector<JDFAttributeMap>- Parameters:
other- in this case VJDFAttributeMap to compare- Returns:
- boolean - true if the maps are equal, otherwise false
-
hashCode
public int hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract- Specified by:
hashCodein interfacejava.util.Collection<JDFAttributeMap>- Specified by:
hashCodein interfacejava.util.List<JDFAttributeMap>- Overrides:
hashCodein classjava.util.Vector<JDFAttributeMap>- Returns:
- int
-
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 Enumvalue- the value to set - may be either String or Enum- Throws:
java.lang.IllegalArgumentException- if key or value have the wrong type
-
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 setvalue- the value to set
-
clone
public VJDFAttributeMap clone()
- Overrides:
clonein classjava.util.Vector<JDFAttributeMap>- Returns:
- See Also:
also clones the underlying maps
-
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-
-
setElementAt
public void setElementAt(JDFAttributeMap mTmp, int j)
- Overrides:
setElementAtin classjava.util.Vector<JDFAttributeMap>
-
-