qflib 0.98.1

de.qfs.lib.option
Class TreeOptionGroup.Tree

java.lang.Object
  |
  +--de.qfs.lib.tree.IndexBasedTreeAdapter
        |
        +--de.qfs.lib.option.TreeOptionGroup.Tree
All Implemented Interfaces:
TreeAdapter
Enclosing class:
TreeOptionGroup

protected class TreeOptionGroup.Tree
extends IndexBasedTreeAdapter

A straightforward tree, implemented in terms of the Node class and the TreeAdapter concept.


Inner classes inherited from class de.qfs.lib.tree.IndexBasedTreeAdapter
IndexBasedTreeAdapter.ChildEnumeration
 
Constructor Summary
TreeOptionGroup.Tree()
          Create a new tree.
 
Method Summary
 TreeOptionGroup.Node findNode(java.lang.String path)
          Find a node by its path name.
 int getChildCount(java.lang.Object parent)
          Get the number of children of a node.
 java.lang.Object getChildNode(java.lang.Object parent, int index)
          Get a child of a node.
 int getIndexOfChildNode(java.lang.Object parent, java.lang.Object child)
          Get the index of a child in a node's list of children.
 java.lang.Object getParentNode(java.lang.Object child)
          Get the parent of a node.
 java.lang.Object getRoot()
          Get the root of the tree.
 boolean isLeaf(java.lang.Object node)
          Query whether a node is a leaf.
 
Methods inherited from class de.qfs.lib.tree.IndexBasedTreeAdapter
getChildren, getFirstChildNode, getLastChildNode, getNextSibling, getPreviousSibling, isEnumerationBased, isIndexBased, isLinkBased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeOptionGroup.Tree

public TreeOptionGroup.Tree()
Create a new tree.
Method Detail

getRoot

public java.lang.Object getRoot()
Get the root of the tree.
Returns:
The root of the tree.

findNode

public TreeOptionGroup.Node findNode(java.lang.String path)
Find a node by its path name.
Parameters:
path - The path of the node.

getParentNode

public java.lang.Object getParentNode(java.lang.Object child)
Get the parent of a node.
Parameters:
child - The node to query for the parent.
Returns:
The parent of the node.

isLeaf

public boolean isLeaf(java.lang.Object node)
Query whether a node is a leaf.
Parameters:
node - The node to query.
Returns:
True if the node is a leaf.

getChildCount

public int getChildCount(java.lang.Object parent)
Get the number of children of a node.
Parameters:
parent - The node to query.
Returns:
The number of children of the node.

getChildNode

public java.lang.Object getChildNode(java.lang.Object parent,
                                     int index)
                              throws java.lang.IndexOutOfBoundsException
Get a child of a node.
Parameters:
parent - The node to query.
index - The index of the child.
Returns:
The child at the index.
Throws:
java.lang.IndexOutOfBoundsException - If the index is invalid.

getIndexOfChildNode

public int getIndexOfChildNode(java.lang.Object parent,
                               java.lang.Object child)
Get the index of a child in a node's list of children.
Parameters:
parent - The node to query.
child - The child to look for.
Returns:
The index of the child or -1 if it is not a child of this node.

qflib 0.98.1