|
||||||||||
| 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.TreeMap<X,Y>
org.knowceans.map.InvertibleTreeMap<X,Y>
public class InvertibleTreeMap<X,Y>
TreeMap that keeps an inverse HashMap. With getInverse(), the (forward) key can easily be found from the (forward) value.
In relational terms, this class implements an n:1 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> |
| Constructor Summary | |
|---|---|
InvertibleTreeMap()
|
|
InvertibleTreeMap(java.util.Comparator<? super X> c)
add the comparator on the keys to provide an ordering. |
|
| Method Summary | |
|---|---|
void |
clear()
|
IMultiMap<Y,X> |
getInverse()
|
java.util.Set<X> |
getInverse(java.lang.Object val)
gets keys for a value as a Set. |
java.util.Set<Y> |
getInverseKeys()
returns the keys of the inverse map. |
static void |
main(java.lang.String[] args)
|
Y |
put(X key,
Y val)
put a new key-value pair. |
Y |
remove(java.lang.Object key)
removes the (forward) key and its value from the map. |
| Methods inherited from class java.util.TreeMap |
|---|
ceilingEntry, ceilingKey, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, putAll, size, subMap, subMap, tailMap, tailMap, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, isEmpty, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode, isEmpty |
| Constructor Detail |
|---|
public InvertibleTreeMap(java.util.Comparator<? super X> c)
c - public InvertibleTreeMap()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void clear()
clear in interface java.util.Map<X,Y>clear in class java.util.TreeMap<X,Y>
public Y put(X key,
Y val)
put in interface java.util.Map<X,Y>put in class java.util.TreeMap<X,Y>public Y remove(java.lang.Object key)
remove in interface java.util.Map<X,Y>remove in class java.util.TreeMap<X,Y>public java.util.Set<X> getInverse(java.lang.Object val)
val -
public java.util.Set<Y> getInverseKeys()
public IMultiMap<Y,X> getInverse()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||