|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.ed.inf.utils.maputils.OneToManyMap<T,U>
public class OneToManyMap<T,U>
A map containing for each key a set of values. No key can be null. At most one key can be an empty-string. No value can be null (the Java TreeSet class used uses "null" as a return message when there is *no* mapping for a given key!). A value can be an empty string.
| Field Summary | |
|---|---|
java.util.TreeMap<T,java.util.Set<U>> |
m_map
the map containing for each key the collection of values that key can have |
| Constructor Summary | |
|---|---|
OneToManyMap()
Initialise an empty map |
|
OneToManyMap(java.util.Vector<T> keys,
java.util.Vector<U> values)
Initialise with a list of key-value pairs |
|
| Method Summary | |
|---|---|
void |
addAll(OneToManyMap<T,U> mapToAdd)
Add all elements of a one2many map to another map |
boolean |
addKeyAndValue(T key,
U value)
Add a key-value pair to the map |
boolean |
containsKey(T key)
Checks if the map contains a key |
boolean |
containsKeyValue(T key,
U value)
Checks if the map contains a specific key-value pair |
boolean |
containsValue(U value)
Checks if the map contains a value |
boolean |
deleteKeyValue(T key,
U value)
|
java.util.Set<U> |
getAKeyValues(T key)
Get the set of unique values for this key. |
java.util.Set<T> |
getKeys()
|
java.util.Vector<java.util.Vector> |
getKeysVectorValuesVector()
Get 1. |
int |
getKeyValuesPairsSize()
Get the number of unique key-value pairs in the map. |
java.util.TreeMap<T,java.util.Set<U>> |
getMap()
|
java.util.Set<T> |
getNonEmptyKeys()
Get the set of unique, non-empty-string keys for this map. |
int |
getNonEmptyKeyValuesPairsSize()
Get the number of unique, non-empty key-value pairs in the map. |
java.util.Set<U> |
getNonEmptyValues()
Get the set of unique, non-empty-string values for this map. |
java.util.Set<U> |
getValues()
Get the set of unique values for this map. |
void |
initialise()
|
boolean |
mapIsNullOrEmpty()
public void initialise(Vector |
int |
size()
|
java.lang.String |
toCSV()
Get a list of comma separated [key, value] couples. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public java.util.TreeMap<T,java.util.Set<U>> m_map
| Constructor Detail |
|---|
public OneToManyMap()
public OneToManyMap(java.util.Vector<T> keys,
java.util.Vector<U> values)
keys - the list of keysvalues - the list of values (the value for each key in the keys list)| Method Detail |
|---|
public void addAll(OneToManyMap<T,U> mapToAdd)
map - the map whose elements have to be added
public boolean addKeyAndValue(T key,
U value)
key - a keyvalue - a value
public boolean containsKey(T key)
key -
public boolean containsKeyValue(T key,
U value)
key - value -
public boolean containsValue(U value)
value - a value
public boolean deleteKeyValue(T key,
U value)
public java.util.Set<U> getAKeyValues(T key)
public java.util.Set<T> getKeys()
public java.util.Vector<java.util.Vector> getKeysVectorValuesVector()
public int getKeyValuesPairsSize()
public java.util.TreeMap<T,java.util.Set<U>> getMap()
public java.util.Set<T> getNonEmptyKeys()
public int getNonEmptyKeyValuesPairsSize()
public java.util.Set<U> getNonEmptyValues()
public java.util.Set<U> getValues()
public void initialise()
public boolean mapIsNullOrEmpty()
public int size()
public java.lang.String toCSV()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||