|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<X,java.util.Set<Y>>
org.knowceans.map.HashMultiMap<X,Y>
org.knowceans.map.InvertibleHashMultiMap<X,Y>
public class InvertibleHashMultiMap<X,Y>
This object maps each key to a Set of values and holds each member of this Set as a link to a Set of keys, i.e., depicts a IMultiMap (object -> set) with an inverse IMultiMap. With getInverse(), the (forward) key set can easily be found from the (forward) value. This effectively implements an M to N relation.
In relational terms, this class implements an m:n relation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
InvertibleHashMultiMap()
|
|
| Method Summary | |
|---|---|
void |
add(X key,
Y value)
adds the value to the key's value set and the key to the value's key set. |
void |
clear()
|
IMultiMap<Y,X> |
getInverse()
|
java.util.Set<X> |
getInverse(java.util.Set<Y> value)
returns the keys that match a given set of value elements |
java.util.Set<Y> |
getInverseKeys()
returns the keys of the inverse map. |
java.util.Set<X> |
getInverseValue(Y val)
gets keys for a value as a Set. |
java.util.Hashtable<Y,java.util.Set<X>> |
getPatternInverse(java.lang.String a)
Returns inverse pattern mapping, specifically for string values in the map. |
java.util.Hashtable<Y,java.util.Set<X>> |
getWildcardInverse(java.lang.String a)
Returns inverse wildcard mapping, specifically for string values in the map. |
static void |
main(java.lang.String[] args)
some simple tests and demonstration for HashMultiMap |
java.util.Set<Y> |
put(X key,
java.util.Set<Y> valSet)
put a new key-valueSet pair. |
java.util.Set<Y> |
remove(X key)
removes the (forward) key and its elements from it value set from the map that map to key. |
void |
remove(X key,
Y value)
removes the value from the key's mapping. |
| Methods inherited from class org.knowceans.map.HashMultiMap |
|---|
getPattern, getWildcard, isPatternCaseInsensitive, isPatternMustMatch, setPatternCaseInsensitive, setPatternMustMatch |
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
| Constructor Detail |
|---|
public InvertibleHashMultiMap()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
args - public void clear()
clear in interface java.util.Map<X,java.util.Set<Y>>clear in class java.util.HashMap<X,java.util.Set<Y>>
public void add(X key,
Y value)
add in interface IMultiMap<X,Y>add in class HashMultiMap<X,Y>key - The key of the new entry.value - The value of the new entry.
public java.util.Set<Y> put(X key,
java.util.Set<Y> valSet)
put in interface java.util.Map<X,java.util.Set<Y>>put in class HashMultiMap<X,Y>public java.util.Set<Y> remove(X key)
public void remove(X key,
Y value)
remove in interface IMultiMap<X,Y>remove in class HashMultiMap<X,Y>key - The key of the new entry.value - The value of the new entry.public java.util.Set<X> getInverseValue(Y val)
getInverseValue in interface IInvertibleMultiMap<X,Y>val -
public java.util.Set<X> getInverse(java.util.Set<Y> value)
getInverse in interface IInvertibleMap<X,java.util.Set<Y>>value -
public IMultiMap<Y,X> getInverse()
public java.util.Hashtable<Y,java.util.Set<X>> getPatternInverse(java.lang.String a)
a -
HashMultiMap#getPattern();public java.util.Hashtable<Y,java.util.Set<X>> getWildcardInverse(java.lang.String a)
a -
HashMultiMap#getPattern();public java.util.Set<Y> getInverseKeys()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||