Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

openfuture.util.misc
Class HashTree  view HashTree download HashTree.java

java.lang.Object
  extended byopenfuture.util.misc.HashTree

public class HashTree
extends java.lang.Object

Tree using a java.util.Hashtable in order to store the child nodes.

Created: Sun May 13 17:13:10 2001

Version:
$Revision: 1.1.1.1 $

Field Summary
(package private)  java.util.Hashtable children
          Hashtable holding all children.
(package private)  java.lang.String name
          Name of the node.
(package private)  HashTree parent
          Parent node
static java.lang.String PATH_SEPARATOR
          String separating a list of elements on a path.
 
Constructor Summary
HashTree(java.lang.String name)
          Creates a new HashTree instance.
HashTree(java.lang.String[] path)
          Creates a new HashTree instance.
 
Method Summary
 void addChild(HashTree child)
          Add a HashTree below as child.
 java.util.Collection children()
          Returns the set of children.
 void dumpTree(java.io.PrintStream stream)
          Dump the tree to the given print stream.
private  void dumpTree(java.io.PrintStream stream, java.lang.String prefix, HashTree node)
          Dump the subtree to the given print stream.
 HashTree getChild(java.lang.String name)
          Retrieve the child with the given name.
protected  java.util.Hashtable getChildren()
          Get the value of children.
 java.lang.String getName()
          Get the value of name.
 HashTree getParent()
          Get the value of parent.
 boolean hasChild(java.lang.String name)
          Check, if a child with the given name exists.
 boolean isLeaf()
          Check, if this node has children.
protected  void setChildren(java.util.Hashtable v)
          Set the value of children.
 void setName(java.lang.String v)
          Set the value of name.
 void setParent(HashTree v)
          Set the value of parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
String separating a list of elements on a path.

See Also:
Constant Field Values

name

java.lang.String name
Name of the node.


children

java.util.Hashtable children
Hashtable holding all children. The name 55 of the node is the key in the Hashtable.


parent

HashTree parent
Parent node

Constructor Detail

HashTree

public HashTree(java.lang.String name)
Creates a new HashTree instance.


HashTree

public HashTree(java.lang.String[] path)
Creates a new HashTree instance.

Method Detail

getName

public java.lang.String getName()
Get the value of name.


setName

public void setName(java.lang.String v)
Set the value of name.


getChildren

protected java.util.Hashtable getChildren()
Get the value of children.


setChildren

protected void setChildren(java.util.Hashtable v)
Set the value of children.


getParent

public HashTree getParent()
Get the value of parent.


setParent

public void setParent(HashTree v)
Set the value of parent.


getChild

public HashTree getChild(java.lang.String name)
Retrieve the child with the given name.


hasChild

public boolean hasChild(java.lang.String name)
Check, if a child with the given name exists.


children

public java.util.Collection children()
Returns the set of children.


isLeaf

public boolean isLeaf()
Check, if this node has children.


addChild

public void addChild(HashTree child)
Add a HashTree below as child. If there exists already a child node with the same name, their subtrees are merged.


dumpTree

public void dumpTree(java.io.PrintStream stream)
Dump the tree to the given print stream.


dumpTree

private void dumpTree(java.io.PrintStream stream,
                      java.lang.String prefix,
                      HashTree node)
Dump the subtree to the given print stream.