RefKeyDictionaryHierarchical interface
A JavaScript object implementing the RefKeyDictionaryHierarchical
interface is very similar to a RefKeyDictionary
, except that get()
methods respect object hierarchy.
This is particularly useful for storing information about object types. If you request a value for an Ref
without an explicit value, the value for the nearest parent will be returned.
Hierarchy is defined using the standard parent attribute, std:attribute:parent
, which is used in the shortcut firstParent()
function in the StoreObject
interface.
Construction
Use O.refdictHierarchical()
. Pass in an optional value constructor function and size hint.
Interface
RefKeyDictionaryHierarchical
implements the interface of RefKeyDictionary
, except:
function get(key)
get()
works identically to RefKeyDictionary
get()
, except that if the dictionary does not contain a value, the nearest parent is returned instead.
function getAllInHierarchy(key)
Returns an Array
, which may be empty, returning all the values in the dictionary for the given object, and all it’s parents.
The array is ordered from the top of the tree to the child node specified by key
.