Package org.cip4.jdflib.util
Class VectorMap<key,vectorObject>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<key,java.util.Vector<vectorObject>>
-
- org.cip4.jdflib.util.VectorMap<key,vectorObject>
-
- Type Parameters:
key- the type used for the keyvectorObject- the type used for individual elements of each vector in the map
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<key,java.util.Vector<vectorObject>>
@Deprecated public class VectorMap<key,vectorObject> extends java.util.HashMap<key,java.util.Vector<vectorObject>>Deprecated.use ListMapHashMap of multiple elements utility class- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VectorMap()Deprecated.null constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidappendUnique(key key, java.util.Vector<vectorObject> vVal)Deprecated.append a map, ensuring uniquenessvoidappendUnique(VectorMap<key,vectorObject> map)Deprecated.append a VectorMap, ensuring uniquenessvoidfillInvertedMap(java.util.Map<vectorObject,key> map)Deprecated.fill this with the values in map by switching key and valuejava.util.Vector<vectorObject>getAllValues()Deprecated.get all values as one big vector, multiple entries are retained (seeContainerUtil.unify())intgetIndex(key key, vectorObject singleObject)Deprecated.get the index of singleObject in the vector of keyjava.util.Map<vectorObject,key>getInvertedMap()Deprecated.get an inverted map that uses all entries a s keys and vice versa
note that the behavior is undefined in case of multiple identical valuesvectorObjectgetOne(java.lang.Object key, int i)Deprecated.get the value for keybooleanisUnique()Deprecated.Getter for bUnique attribute.voidputOne(key key, vectorObject val)Deprecated.put the value for key, ensuring uniquenessvoidremoveOne(key key, vectorObject val)Deprecated.remove the value for key,also remove key if the vector is emptyvoidsetOne(key key, vectorObject newObj, int pos)Deprecated.insert the value for keyat position posvoidsetOne(key key, vectorObject newObj, vectorObject oldObj)Deprecated.replace the value for key, add if oldObj==null or is not therevoidsetUnique(boolean bUnique)Deprecated.Setter for bUnique attribute.intsize(key key)Deprecated.get the size of the vector for key-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
fillInvertedMap
public void fillInvertedMap(java.util.Map<vectorObject,key> map)
Deprecated.fill this with the values in map by switching key and value- Parameters:
map-
-
getOne
public vectorObject getOne(java.lang.Object key, int i)
Deprecated.get the value for key- Parameters:
key- the search keyi- the index in the vecor matching key; if <0 count from the back of the vector- Returns:
- the matching vectorObject; null if the key does not exist or i is out of range
-
getIndex
public int getIndex(key key, vectorObject singleObject)
Deprecated.get the index of singleObject in the vector of key- Parameters:
key- the key of the vectorsingleObject- the object to search- Returns:
- -2: no such key; -1: no value in key; else the index in the vexctor of key
-
size
public int size(key key)
Deprecated.get the size of the vector for key- Parameters:
key- the key of the vector- Returns:
- the size of the vector for key, 0 if no key exists
-
putOne
public void putOne(key key, vectorObject val)
Deprecated.put the value for key, ensuring uniqueness- Parameters:
key- the key of the vectorval- the vector element
-
appendUnique
public void appendUnique(key key, java.util.Vector<vectorObject> vVal)
Deprecated.append a map, ensuring uniqueness- Parameters:
key- the key of the vectorvVal- the vector of elements
-
appendUnique
public void appendUnique(VectorMap<key,vectorObject> map)
Deprecated.append a VectorMap, ensuring uniqueness- Parameters:
map- the map to add
-
getAllValues
public java.util.Vector<vectorObject> getAllValues()
Deprecated.get all values as one big vector, multiple entries are retained (seeContainerUtil.unify())- Returns:
- a vector of all values, null if empty
-
getInvertedMap
public java.util.Map<vectorObject,key> getInvertedMap()
Deprecated.get an inverted map that uses all entries a s keys and vice versa
note that the behavior is undefined in case of multiple identical values- Returns:
- an inverted map
-
removeOne
public void removeOne(key key, vectorObject val)
Deprecated.remove the value for key,also remove key if the vector is empty- Parameters:
key- the key of the vectorval- the vector element
-
setOne
public void setOne(key key, vectorObject newObj, vectorObject oldObj)
Deprecated.replace the value for key, add if oldObj==null or is not there- Parameters:
key- the key of the vectornewObj- the new object to setoldObj- the old object to replace
-
setOne
public void setOne(key key, vectorObject newObj, int pos)
Deprecated.insert the value for keyat position pos- Parameters:
key- the key of the vectornewObj- the new object to setpos- the index in the vector, may be <0 to count from the end- Throws:
java.lang.IllegalArgumentException- if pos is negative and abs(pos)>size()
-
isUnique
public boolean isUnique()
Deprecated.Getter for bUnique attribute.- Returns:
- the bUnique
-
setUnique
public void setUnique(boolean bUnique)
Deprecated.Setter for bUnique attribute.- Parameters:
bUnique- the bUnique to set
-
-