org.favabeans.util
Class DagInheritanceMap

java.lang.Object
  |
  +--org.favabeans.util.DagInheritanceMap
All Implemented Interfaces:
InheritanceMap, Map

public class DagInheritanceMap
extends Object
implements InheritanceMap

A DagInheritanceMap is an implementation of interface InheritanceMap backed by a DagPoset and a HashMap.


Inner classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
DagInheritanceMap()
          Construct a new, empty DagInheritanceMap.
DagInheritanceMap(PoComparator comparator)
          Construct a new, empty DagInheritanceMap.
 
Method Summary
 void clear()
           
 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.
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object x)
           
 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.
 int hashCode()
           
 boolean isEmpty()
           
 Poset keyPoset()
          Return a Poset view of the keys of this InheritanceMap.
 Set keySet()
           
 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.
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DagInheritanceMap

public DagInheritanceMap()
Construct a new, empty DagInheritanceMap.

DagInheritanceMap

public DagInheritanceMap(PoComparator comparator)
Construct a new, empty DagInheritanceMap.
Parameters:
comparator - the object used to impose the partial ordering on the keys of this DagInheritanceMap.
Method Detail

size

public int size()
Specified by:
size in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

containsKey

public boolean containsKey(Object key)
Description copied from interface: InheritanceMap
Determine if this InheritanceMap maps a given key, or one of its super-keys, to a value.
Specified by:
containsKey in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
key - a key which may be in this InheritanceMap.
Returns:
true if the supplied key, or one of its super-keys, is mapped to a value.

containsKey

public boolean containsKey(Object key,
                           boolean inherit)
Description copied from interface: InheritanceMap
Determine if this InheritanceMap maps a given key to a value.
Specified by:
containsKey in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
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.
Returns:
true if the supplied key or, if applicable, one of its super-keys, is mapped to a value.

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

get

public Object get(Object key)
Description copied from interface: InheritanceMap
Return the associated value for the given key or a super-key of that key.
Specified by:
get in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
key - the key for which a value is required.
Returns:
the associated value, or null if none could be found.

get

public Object get(Object key,
                  boolean inherit)
Description copied from interface: InheritanceMap
Return the associated value for the given key.
Specified by:
get in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
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.
Returns:
the value associated with the supplied key or, if applicable, one of its super-keys, or null if none could be found.

put

public Object put(Object key,
                  Object value)
Description copied from interface: InheritanceMap
Create a direct association from a key to a value.
Specified by:
put in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
key - the key with which to associate the value.
value - the value to associate with the supplied key.
Returns:
the value previously associated with the supplied key, or null if none existed.

remove

public Object remove(Object key)
Description copied from interface: InheritanceMap
Remove the direct association between a key and a value.
Specified by:
remove in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
key - the key for which to remove the associated value.
Returns:
the previously associated value for key, or null if no value was previously associated.

putAll

public void putAll(Map map)
Description copied from interface: InheritanceMap
Invoke InheritanceMap.put(Object, Object) for each (key, value) entry in a supplied Map.
Specified by:
putAll in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Parameters:
map - the Map from which to obtain the (key, value) entries.

clear

public void clear()
Specified by:
clear in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

keyPoset

public Poset keyPoset()
Description copied from interface: InheritanceMap
Return a Poset view of the keys of this InheritanceMap.
Specified by:
keyPoset in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Returns:
a Poset.

values

public Collection values()
Specified by:
values in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

comparator

public PoComparator comparator()
Specified by:
comparator in interface InheritanceMap
Following copied from interface: org.favabeans.util.InheritanceMap
Returns:
the 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.

equals

public boolean equals(Object x)
Specified by:
equals in interface Map
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.