|
||||||||||
| 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>
public class HashMultiMap<X,Y>
Implementation of the IMultiMap interface backed by a HashMap. Maps a key to a Set of values.
In relational terms, this class implements a m:n relation, but without reverse lookup.
This multimap supports wildcard and pattern search, however based on full iteration of the mapEntries. (TODO: put in better algorithm for wildcard expansion).
| 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 | |
|---|---|
HashMultiMap()
|
|
| Method Summary | |
|---|---|
void |
add(X key,
Y value)
add a value to the set of values for a key. |
java.util.Hashtable<X,java.util.Set<Y>> |
getPattern(java.lang.String pattern)
get all entries that match a specific pattern. |
java.util.Hashtable<X,java.util.Set<Y>> |
getWildcard(java.lang.String wildcard)
return all entries that match a specific wildcard. |
boolean |
isPatternCaseInsensitive()
|
boolean |
isPatternMustMatch()
|
static void |
main(java.lang.String[] args)
|
java.util.Set<Y> |
put(X key,
java.util.Set<Y> value)
put a complete Set of values to a key. |
void |
remove(X key,
Y value)
remove one value out of the set of values for one key. |
void |
setPatternCaseInsensitive(boolean b)
|
void |
setPatternMustMatch(boolean b)
|
| Methods inherited from class java.util.HashMap |
|---|
clear, 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 |
|---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
| Constructor Detail |
|---|
public HashMultiMap()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void add(X key,
Y value)
add in interface IMultiMap<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> value)
add(X, Y), we must ensure that only
Sets ever get put into this map. Using JSR14, this would not be a
problem.
put in interface java.util.Map<X,java.util.Set<Y>>put in class java.util.HashMap<X,java.util.Set<Y>>public java.util.Hashtable<X,java.util.Set<Y>> getPattern(java.lang.String pattern)
getPattern in interface IPatternMap<X,java.util.Set<Y>>pattern -
public java.util.Hashtable<X,java.util.Set<Y>> getWildcard(java.lang.String wildcard)
getWildcard in interface IPatternMap<X,java.util.Set<Y>>
public void remove(X key,
Y value)
remove in interface IMultiMap<X,Y>key - The key of the new entry.value - The value of the new entry.public boolean isPatternCaseInsensitive()
public boolean isPatternMustMatch()
public void setPatternCaseInsensitive(boolean b)
b - public void setPatternMustMatch(boolean b)
b -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||