|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An InheritanceMap
is a Map
which
imposes a partial ordering (see Poset
) on its keys. When
the Map.get(Object)
method is invoked, if the
supplied key is not found, the InheritanceMap
searches
in its set of keys for one that is greater than the
supplied one and, if one is found, it returns the value mapped to
that key. Thus, the supplied key can be said to "inherit" the value
mapped to a key greater than itself.
Inner classes inherited from class java.util.Map |
Map.Entry |
Method Summary | |
PoComparator |
comparator()
|
boolean |
containsKey(Object key)
Determine if this InheritanceMap maps a given key,
or one of its super-keys, to a value. |
boolean |
containsKey(Object key,
boolean inherit)
Determine if this InheritanceMap maps a given key
to a value. |
Object |
get(Object key)
Return the associated value for the given key or a super-key of that key. |
Object |
get(Object key,
boolean inherit)
Return the associated value for the given key. |
Poset |
keyPoset()
Return a Poset view of the keys of this
InheritanceMap . |
Object |
put(Object key,
Object value)
Create a direct association from a key to a value. |
void |
putAll(Map map)
Invoke put(Object, Object) for each (key ,
value ) entry in a supplied Map . |
Object |
remove(Object key)
Remove the direct association between a key and a value. |
Methods inherited from interface java.util.Map |
clear, containsValue, entrySet, equals, hashCode, isEmpty, keySet, size, values |
Method Detail |
public boolean containsKey(Object key)
InheritanceMap
maps a given key,
or one of its super-keys, to a value.containsKey
in interface Map
key
- a key which may be in this
InheritanceMap
.true
if the supplied key
, or
one of its super-keys, is mapped to a value.public boolean containsKey(Object key, boolean inherit)
InheritanceMap
maps a given key
to a value.key
- a key which may be in this
InheritanceMap
.inherit
- set to true
if super-keys are to be
included in the search; false
if only directly
mapped keys are to be searched.true
if the supplied key
or,
if applicable, one of its super-keys, is mapped to a value.public Object get(Object key)
get
in interface Map
key
- the key for which a value is required.null
if none
could be found.public Object get(Object key, boolean inherit)
key
- the key for which a value is required.inherit
- set to true
if super-keys are to be
included in the search; false
if only directly
mapped keys are to be searched.null
if none
could be found.public Object put(Object key, Object value)
put
in interface Map
key
- the key with which to associate the value.value
- the value to associate with the supplied key.null
if none existed.public Object remove(Object key)
remove
in interface Map
key
- the key for which to remove the associated value.key
,
or null
if no value was previously associated.public void putAll(Map map)
put(Object, Object)
for each (key
,
value
) entry in a supplied Map
.putAll
in interface Map
map
- the Map
from which to obtain the
(key
, value
) entries.public Poset keyPoset()
Poset
view of the keys of this
InheritanceMap
.Poset
.public PoComparator comparator()
PoComparator
used to implement the partial
ordering on the keys of this InheritanceMap
, or
null
if this InheritanceMap
expects
its elements to be instances of PoComparable
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |