Joda System API

org.joda.util
Interface TreeNode

All Known Subinterfaces:
TreeNode.Internal
All Known Implementing Classes:
ArrayTreeNode

public interface TreeNode

TreeNode defines a node in a tree structure. The easiest way to use the node is to use the user object parameter.

Author:
Stephen Colebourne

Nested Class Summary
static interface TreeNode.Internal
          TreeNode implementors should implement TreeNode.Internal instead of just TreeNode.
 
Method Summary
 TreeNode getChild(int index)
          Get the child of this node at a particular index
 java.util.List getChildren()
          Get the children of this node
 TreeNode getParent()
          Get the parent of this node
 java.lang.Object getValue()
          Get the user object of this node
 boolean isLeaf()
          Is this a leaf node (has no children)
 boolean isRoot()
          Is this a root node (has no parent)
 void removeFromParent()
          Detach this node from its parent
 void setValue(java.lang.Object object)
          Set the user object of this node
 TreeIterator treeIterator()
          Get a tree iterator from this node.
 

Method Detail

isRoot

public boolean isRoot()
Is this a root node (has no parent)

Returns:
true if no parent

getParent

public TreeNode getParent()
Get the parent of this node

Returns:
the object that is the parent of this node

isLeaf

public boolean isLeaf()
Is this a leaf node (has no children)

Returns:
true if no children

getChild

public TreeNode getChild(int index)
Get the child of this node at a particular index

Parameters:
index - the index to obtain
Returns:
the object that is the parent of this node

getChildren

public java.util.List getChildren()
Get the children of this node

Returns:
the list of children

removeFromParent

public void removeFromParent()
Detach this node from its parent


treeIterator

public TreeIterator treeIterator()
Get a tree iterator from this node. Traversal is depth first.

Returns:
the tree iterator

getValue

public java.lang.Object getValue()
Get the user object of this node

Returns:
the user object value

setValue

public void setValue(java.lang.Object object)
Set the user object of this node

Parameters:
object - the new user object value

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.