ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.filespace
Class HashTree

java.lang.Object
  extended byjavafe.filespace.Tree
      extended byjavafe.filespace.HashTree
Direct Known Subclasses:
ExtTree, PreloadedTree

abstract class HashTree
extends Tree

A HashTree is a Tree that uses a Hashtable to store the map between labels and its direct children.

This abstract class leaves how the Hashtable should be filled up to its subclasses.


Field Summary
protected  java.util.Hashtable edges
          The mapping between our outgoing edge's labels and the subTrees they point to.
 
Fields inherited from class javafe.filespace.Tree
data
 
Constructor Summary
  HashTree(java.lang.Object data)
          Create a root node:
protected HashTree(Tree parent, java.lang.String label, java.lang.Object data)
          Create a non-root node:
 
Method Summary
 java.util.Enumeration children()
          An enumeration of this node's direct children.
 Tree getChild(java.lang.String label)
          Fetch our direct child along the edge labelled label.
 
Methods inherited from class javafe.filespace.Tree
getChildrenCount, getLabel, getParent, getQualifiedChild, getQualifiedName, getRootNode, getSimpleName, isLeaf, print, printDetails
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

edges

protected java.util.Hashtable edges
The mapping between our outgoing edge's labels and the subTrees they point to. No entry for a label means no edge with that label exists.

Invariant: all elements of edges are Trees and all keys are Strings.

Constructor Detail

HashTree

public HashTree(java.lang.Object data)
Create a root node:


HashTree

protected HashTree(Tree parent,
                   java.lang.String label,
                   java.lang.Object data)
Create a non-root node:

Method Detail

children

public java.util.Enumeration children()
An enumeration of this node's direct children. Each child occurs exactly once in the enumeration. The order is unspecified and may differ from call to call.

Note: The Objects returned by the resulting enumeration's nextElement method are guaranteed to be of type Tree and non-null.

Specified by:
children in class Tree

getChild

public Tree getChild(java.lang.String label)
Fetch our direct child along the edge labelled label. Iff there is no such child, return null.

Overrides:
getChild in class Tree

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage