org.biojava.utils
Class OverlayMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended byorg.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 Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
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
 

Constructor Detail

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 Map
overlay - 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
Method Detail

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)

entrySet

public java.util.Set entrySet()

keySet

public java.util.Set keySet()

containsKey

public boolean containsKey(java.lang.Object key)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)