|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap org.geotools.util.DerivedMap
A map whose keys are derived from an other map. The keys are derived only when
requested, which make it possible to backup potentially large maps. Implementations
need only to overrides baseToDerived(java.lang.Object)
and derivedToBase(java.lang.Object)
methods.
This set do not supports key, since is used
when no mapping from base to exists.
This class is serializable if the underlying base set is serializable
too.
Field Summary | |
protected java.util.Map |
base
The base map whose keys are derived from. |
Constructor Summary | |
DerivedMap(java.util.Map base)
Creates a new derived map from the specified base map. |
Method Summary | |
protected abstract java.lang.Object |
baseToDerived(java.lang.Object key)
Transforms a key from the base map to a key in this map. |
boolean |
containsKey(java.lang.Object key)
Returns if this map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns if this map maps one or more keys to this value. |
protected abstract java.lang.Object |
derivedToBase(java.lang.Object key)
Transforms a key from this derived map to a key in the base map. |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this map. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which this map maps the specified key. |
boolean |
isEmpty()
Returns if this map contains no key-value mappings. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this map if present. |
int |
size()
Returns the number of key-value mappings in this map. |
java.util.Collection |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class java.util.AbstractMap |
clear, clone, equals, hashCode, putAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final java.util.Map base
baseToDerived(java.lang.Object)
,
derivedToBase(java.lang.Object)
Constructor Detail |
public DerivedMap(java.util.Map base)
base
- The base map.Method Detail |
protected abstract java.lang.Object baseToDerived(java.lang.Object key)
key
- A ley from the base map.
protected abstract java.lang.Object derivedToBase(java.lang.Object key)
key
- A key in this map.
public int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
base.containsValue(value)
.
containsValue
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
base.containsKey(derivedToBase(key))
.
containsKey
in interface java.util.Map
key
- key whose presence in this map is to be tested.
public java.lang.Object get(java.lang.Object key)
base.get(derivedToBase(key))
.
get
in interface java.util.Map
key
- key whose associated value is to be returned.
public java.lang.Object put(java.lang.Object key, java.lang.Object value) throws java.lang.UnsupportedOperationException
base.put(derivedToBase(key), value)
.
put
in interface java.util.Map
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
java.lang.UnsupportedOperationException
- if the base map doesn't
supports the operation.public java.lang.Object remove(java.lang.Object key) throws java.lang.UnsupportedOperationException
base.remove(derivedToBase(key))
.
remove
in interface java.util.Map
key
- key whose mapping is to be removed from the map.
java.lang.UnsupportedOperationException
- if the base map doesn't
supports the operation.public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |