org.knime.base.node.viz.plotter.dendrogram
Class BinaryTreeNode<T>

java.lang.Object
  extended by org.knime.base.node.viz.plotter.dendrogram.BinaryTreeNode<T>
Type Parameters:
T - the type of the nodes content.

public class BinaryTreeNode<T>
extends Object

A generic tree with a content, a reference to the parent node and with a left child and a right child. Everything might be null except of the content, i.e. the children and the parent might be added later but only once. Nodes without children are considered ot be leaf nodes, i.e. isLeaf() returns true.

Author:
Fabian Dill, University of Konstanz

Constructor Summary
BinaryTreeNode(T content)
          The content of a BinaryTreeNode is final and is set only once.
 
Method Summary
 T getContent()
           
 BinaryTreeNode<T> getLeftChild()
           
 BinaryTreeNode<T> getParent()
           
 BinaryTreeNode<T> getRightChild()
           
 boolean isLeaf()
           
 void setLeftChild(BinaryTreeNode<T> leftChild)
          The parent of the node can be set only once, if the left child is already set an IllegalArgumentException is thrown.
 void setParent(BinaryTreeNode<T> parent)
          The parent of the node can be set only once, if the parent is already set an IllegalArgumentException is thrown.
 void setRightChild(BinaryTreeNode<T> rightChild)
          * The parent of the node can be set only once, if the right child is already set an IllegalArgumentException is thrown.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryTreeNode

public BinaryTreeNode(T content)
The content of a BinaryTreeNode is final and is set only once.

Parameters:
content - the content of the node.
Method Detail

getContent

public T getContent()
Returns:
the node's content.

getParent

public BinaryTreeNode<T> getParent()
Returns:
the parent of the node.

setParent

public void setParent(BinaryTreeNode<T> parent)
The parent of the node can be set only once, if the parent is already set an IllegalArgumentException is thrown.

Parameters:
parent - the parent of this node.
Throws:
IllegalArgumentException - if the parent is already set.

getLeftChild

public BinaryTreeNode<T> getLeftChild()
Returns:
the left child of this node.

setLeftChild

public void setLeftChild(BinaryTreeNode<T> leftChild)
The parent of the node can be set only once, if the left child is already set an IllegalArgumentException is thrown.

Parameters:
leftChild - the left child of this node
Throws:
IllegalArgumentException - if the left child is already set.

getRightChild

public BinaryTreeNode<T> getRightChild()
Returns:
the right child of this node.

setRightChild

public void setRightChild(BinaryTreeNode<T> rightChild)
* The parent of the node can be set only once, if the right child is already set an IllegalArgumentException is thrown.

Parameters:
rightChild - the right child.
Throws:
IllegalArgumentException - if the right child is already set.

isLeaf

public boolean isLeaf()
Returns:
true if this node is a leaf node.

toString

public String toString()

Overrides:
toString in class Object


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.