|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.ds.TwoLevelMap
public class TwoLevelMap
HashMap based two-level Map. A value can be associated with a "key path" which is an ordered list of two keys. It can be also be determined if something has been associated with the first component of a key path irrespective of the concrete second component of the key path.
| Constructor Summary | |
|---|---|
TwoLevelMap()
Constructs an empty TwoLevelMap. |
|
TwoLevelMap(java.lang.String name)
Constructs an empty TwoLevelMap with the specified name. |
|
TwoLevelMap(java.lang.String name,
int initialCapacity)
Constructs an empty TwoLevelMap with the specified name and initial capacity. |
|
| Method Summary | |
|---|---|
boolean |
containsKey(java.lang.Object key1)
Returns true if this map contains a mapping for the specified key path component. |
boolean |
containsKey(java.lang.Object key1,
java.lang.Object key2)
Returns true if this map contains a mapping for the specified key path. |
boolean |
containsKey(Pair p)
Returns true if this map contains a mapping for the specified key path designated by the specified Pair |
java.util.Set |
firstKeySet()
|
java.util.HashMap |
get(java.lang.Object key1)
Returns the Map of values to which the specified key path component is mapped in this map, or null if the map contains no mapping for this key path component. |
java.lang.Object |
get(java.lang.Object key1,
java.lang.Object key2)
Returns the value to which the specified key path is mapped in this map, or null if the map contains no mapping for this key path. |
java.lang.Object |
get(Pair p)
Returns the value to which the specified key path designated by the Pair is mapped in this map, or null if the map contains no mapping for this key path. |
java.lang.Object |
put(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object value)
Associates the specified value with the specified key path key1 / key2 in this map. |
java.lang.Object |
put(Pair p,
java.lang.Object value)
Associates the specified value with the key path designated by the Pair in this map. |
java.util.HashMap |
remove(java.lang.Object key1)
Removes the mapping for this key path component from this map if present. |
java.lang.Object |
remove(java.lang.Object key1,
java.lang.Object key2)
Removes the mapping for this key path from this map if present. |
java.lang.Object |
remove(Pair p)
Removes the mapping for the key path designated by the specified Pair from this map if present. |
int |
size()
Returns the number of first level key path mappings in this map. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TwoLevelMap(java.lang.String name,
int initialCapacity)
name - the name of this map.initialCapacity - the initial capacity.public TwoLevelMap(java.lang.String name)
name - the name of this map.public TwoLevelMap()
| Method Detail |
|---|
public java.lang.Object put(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object value)
key1 - the first component of the key path with which the specified value is to be associated.key2 - the second component of the key path with which the specified value is to be associated.value - value to be associated with the specified key path.
public java.lang.Object put(Pair p,
java.lang.Object value)
p - the Pair designating the key path
p.first() designated the first path component,
p.second() designates the second path componentvalue - value to be associated with the specified key path.
public java.util.HashMap get(java.lang.Object key1)
key1 - the first component of the key path whose associated map is to be returned.
put(Object, Object, Object)
public java.lang.Object get(java.lang.Object key1,
java.lang.Object key2)
key1 - the first component of the key path whose associated map is to be returned.key2 - the second component of the key path whose associated map is to be returned.
put(Object, Object, Object)public java.lang.Object get(Pair p)
p - the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
put(Pair, Object)public boolean containsKey(java.lang.Object key1)
key1 - The first part of the key path whose presence in this map is to be tested
public boolean containsKey(java.lang.Object key1,
java.lang.Object key2)
key1 - The first part of the key path whose presence in this map is to be testedkey2 - The second part of the key path whose presence in this map is to be tested
public boolean containsKey(Pair p)
p - the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
public java.util.HashMap remove(java.lang.Object key1)
key1 - key path component whose mapping is to be removed from the map.
public java.lang.Object remove(java.lang.Object key1,
java.lang.Object key2)
key1 - the first component of the key path whose mapping is to be removed from the map.key2 - the second component of the key path whose mapping is to be removed from the map.
public java.lang.Object remove(Pair p)
p - the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
public java.lang.String toString()
toString in class java.lang.Objectpublic int size()
public java.util.Set firstKeySet()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||