org.biojava.utils
Class OverlayMap
java.lang.Object
java.util.AbstractMap
org.biojava.utils.OverlayMap
- All Implemented Interfaces:
- java.util.Map
public class OverlayMap
- extends java.util.AbstractMap
Overlap one map onto another. This allows you to have a map with local values
and default values. The local and default values are provided by a child and
parent map.
- Author:
- Thomas Down, Matthew Pocock
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 |
OverlayMap(java.util.Map parent)
Build a new map with default key-value pairs. |
OverlayMap(java.util.Map parent,
java.util.Map overlay)
Build a new map with default key-value pairs. |
Method Summary |
boolean |
containsKey(java.lang.Object key)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.util.Map |
getOverlayMap()
Return the object containing the overlay mappings. |
java.util.Map |
getParentMap()
Return the object containing the fallback mappings. |
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
Methods inherited from class java.util.AbstractMap |
clear, clone, containsValue, equals, hashCode, isEmpty, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
OverlayMap
public OverlayMap(java.util.Map parent,
java.util.Map overlay)
- Build a new map with default key-value pairs.
- Parameters:
parent
- the default fall-through Mapoverlay
- the overriding Map
OverlayMap
public OverlayMap(java.util.Map parent)
- Build a new map with default key-value pairs.
- Parameters:
parent
- the default fall-through Map
getParentMap
public java.util.Map getParentMap()
- Return the object containing the fallback mappings.
This is the actual parent map, not a copy.
- Returns:
- the parent map
getOverlayMap
public java.util.Map getOverlayMap()
- Return the object containing the overlay mappings.
This is the actual child map, not a copy.
- Returns:
- the child map
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get
in interface java.util.Map
- Overrides:
get
in class java.util.AbstractMap
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet
in interface java.util.Map
- Specified by:
entrySet
in class java.util.AbstractMap
keySet
public java.util.Set keySet()
- Specified by:
keySet
in interface java.util.Map
- Overrides:
keySet
in class java.util.AbstractMap
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interface java.util.Map
- Overrides:
containsKey
in class java.util.AbstractMap
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put
in interface java.util.Map
- Overrides:
put
in class java.util.AbstractMap