org.favabeans.util
Class DagInheritanceProperties

java.lang.Object
  |
  +--org.favabeans.util.DagInheritanceProperties
All Implemented Interfaces:
InheritanceProperties
Direct Known Subclasses:
DefaultTypeMetadataRegistry

public class DagInheritanceProperties
extends Object
implements InheritanceProperties

A DagInheritanceProperties is an implementation of InheritanceProperties that represents the relationship between the contexts as a dag, and is therefore backed by a DagPoset.


Constructor Summary
DagInheritanceProperties()
          Construct a new, empty DagInheritanceProperties.
DagInheritanceProperties(PoComparator comparator)
          Construct a new, empty DagInheritanceProperties.
 
Method Summary
 void clear()
          Remove all entries in this InheritanceProperties.
 PoComparator comparator()
           
 boolean containsKey(Object context, Object key)
          Determine if this InheritanceProperties maps a given key to a value in a given context, or one of its super-contexts.
 boolean containsKey(Object context, Object key, boolean inherit)
          Determine if this InheritanceProperties maps a given key to a value in a given context.
 Poset contextPoset()
          Return a Poset view of the contexts of this InheritanceProperties.
 Object get(Object context, Object key)
          Return the associated value for the given key in the specified context or one of its super-contexts.
 Object get(Object context, Object key, boolean inherit)
          Return the associated value for the given key in the specified context.
 Set getKeys(Object context)
          Get the keys associated with a given context, or one of its super-contexts.
 Set getKeys(Object context, boolean inherit)
          Get the keys associated with a given context.
 Object put(Object context, Object key, Object value)
          Create a direct association from a key to a value.
 Object remove(Object context, Object key)
          Remove the direct association between a key and a value in a given context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DagInheritanceProperties

public DagInheritanceProperties()
Construct a new, empty DagInheritanceProperties.

DagInheritanceProperties

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

containsKey

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

containsKey

public boolean containsKey(Object context,
                           Object key,
                           boolean inherit)
Description copied from interface: InheritanceProperties
Determine if this InheritanceProperties maps a given key to a value in a given context.
Specified by:
containsKey in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context in which to resolve the key.
key - a key which may be in this InheritanceProperties.
inherit - set to true if super-contexts are to be included in the search; false if only the specified context is to be searched.
Returns:
true if the supplied key is mapped to a value in the specified context or, if applicable, one of its super-contexts.

get

public Object get(Object context,
                  Object key)
Description copied from interface: InheritanceProperties
Return the associated value for the given key in the specified context or one of its super-contexts.
Specified by:
get in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context in which to resolve the key.
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 context,
                  Object key,
                  boolean inherit)
Description copied from interface: InheritanceProperties
Return the associated value for the given key in the specified context.
Specified by:
get in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context in which to resolve the key.
key - the key for which a value is required.
inherit - set to true if super-contexts are to be included in the search; false if only the specified context is 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 context,
                  Object key,
                  Object value)
Description copied from interface: InheritanceProperties
Create a direct association from a key to a value.
Specified by:
put in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context in which to associate the value with the key.
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 in the supplied context, or null if none existed.

remove

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

contextPoset

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

comparator

public PoComparator comparator()
Specified by:
comparator in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Returns:
the PoComparator used to implement the partial ordering on the contexts of this InheritanceProperties, or null if this InheritanceProperties expects its contexts to be instances of PoComparable.

getKeys

public Set getKeys(Object context)
Description copied from interface: InheritanceProperties
Get the keys associated with a given context, or one of its super-contexts.
Specified by:
getKeys in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context for which to obtain the keys.
Returns:
the keys associated with this context, or an empty set if the context is not a member of this InheritanceProperties and has no super-contexts in this InheritanceProperties.

getKeys

public Set getKeys(Object context,
                   boolean inherit)
Description copied from interface: InheritanceProperties
Get the keys associated with a given context.
Specified by:
getKeys in interface InheritanceProperties
Following copied from interface: org.favabeans.util.InheritanceProperties
Parameters:
context - the context for which to obtain the keys.
inherit - whether to obtain keys for the super-contexts of this context.
Returns:
the keys associated with this context and, if applicable, its super-contexts, or an empty set if the context is not a member of this InheritanceProperties and, if applicable, has no super-contexts in this InheritanceProperties.

clear

public void clear()
Description copied from interface: InheritanceProperties
Remove all entries in this InheritanceProperties.
Specified by:
clear in interface InheritanceProperties


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