uk.ac.manchester.cs.bhig.util
Interface Tree<N>

All Known Implementing Classes:
EntailedAxiomTree, ExplanationTree, MutableTree

public interface Tree<N>

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 22-Jan-2008


Method Summary
 void dump(java.io.PrintWriter writer)
           
 void dump(java.io.PrintWriter writer, int indent)
           
 java.util.List<N> fillDepthFirst()
           
 int getChildCount()
          A convenience method that gets the number of child nodes that this node has.
 java.util.List<Tree<N>> getChildren()
          Gets the children of this tree node.
 java.lang.Object getEdge(Tree<N> child)
           
 Tree<N> getParent()
          Gets the parent of this tree node.
 java.util.List<Tree<N>> getPathToRoot()
           
 Tree<N> getRoot()
          A convenience method that gets the root of this tree.
 N getUserObject()
          Gets the "content" of this tree node.
 java.util.Set<N> getUserObjectClosure()
           
 java.util.List<N> getUserObjectPathToRoot()
           
 boolean isLeaf()
          A convenience method that determines if this node is a leaf node (because it has no children).
 boolean isRoot()
          A convenience method that determines if this is a root node (because it has no parent node)
 void setNodeRenderer(NodeRenderer<N> renderer)
           
 void sortChildren(java.util.Comparator<Tree<N>> comparator)
          Sorts the children using the specified comparator
 

Method Detail

getUserObject

N getUserObject()
Gets the "content" of this tree node.

Returns:
The user content of this node.

getParent

Tree<N> getParent()
Gets the parent of this tree node.

Returns:
The parent tree node, or null if this node doesn't have a parent.

getChildren

java.util.List<Tree<N>> getChildren()
Gets the children of this tree node.

Returns:
A list of children. If this tree node doesn't have any children then the list will be empty.

getEdge

java.lang.Object getEdge(Tree<N> child)

sortChildren

void sortChildren(java.util.Comparator<Tree<N>> comparator)
Sorts the children using the specified comparator

Parameters:
comparator - The comparator to be used for the sorting.

getChildCount

int getChildCount()
A convenience method that gets the number of child nodes that this node has.

Returns:
The count of the number of children of this node.

isRoot

boolean isRoot()
A convenience method that determines if this is a root node (because it has no parent node)

Returns:
true if this is a root node, otherwise false.

isLeaf

boolean isLeaf()
A convenience method that determines if this node is a leaf node (because it has no children).

Returns:
true if this node is a leaf node otherwise false.

getRoot

Tree<N> getRoot()
A convenience method that gets the root of this tree.

Returns:
The root node, which could be this node.

getPathToRoot

java.util.List<Tree<N>> getPathToRoot()

getUserObjectPathToRoot

java.util.List<N> getUserObjectPathToRoot()

dump

void dump(java.io.PrintWriter writer)

dump

void dump(java.io.PrintWriter writer,
          int indent)

setNodeRenderer

void setNodeRenderer(NodeRenderer<N> renderer)

getUserObjectClosure

java.util.Set<N> getUserObjectClosure()

fillDepthFirst

java.util.List<N> fillDepthFirst()