Algorithm
Development Kit 1.0

algs.model.tree
Class BinaryNode<T extends java.lang.Comparable>

java.lang.Object
  extended by algs.model.tree.BinaryNode<T>
Type Parameters:
T - the base type of the values stored by the BinaryNode. Must be Comparable.
All Implemented Interfaces:
IGraphEntity, IBinaryTreeNode
Direct Known Subclasses:
RightThreadedBinaryNode

public class BinaryNode<T extends java.lang.Comparable>
extends java.lang.Object
implements IBinaryTreeNode, IGraphEntity

Standard node for an unbalanced binary tree.

Supports ability to be part of graphical output.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Nested Class Summary
 
Nested classes/interfaces inherited from interface algs.debug.IGraphEntity
IGraphEntity.Formatter
 
Constructor Summary
BinaryNode(T value)
          Default BinaryTree constructor.
 
Method Summary
 BinaryNode<T> getLeftSon()
          Return the left son associated with this node.
 BinaryNode<T> getRightSon()
          Return the right son associated with this node.
 T getValue()
          Return the value for this node.
 java.lang.String nodeLabel()
          Node Label for binary node.
 java.lang.String toString()
          Return representation of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryNode

public BinaryNode(T value)
Default BinaryTree constructor.

Method Detail

getLeftSon

public BinaryNode<T> getLeftSon()
Description copied from interface: IBinaryTreeNode
Return the left son associated with this node.

Specified by:
getLeftSon in interface IBinaryTreeNode

getRightSon

public BinaryNode<T> getRightSon()
Description copied from interface: IBinaryTreeNode
Return the right son associated with this node.

Specified by:
getRightSon in interface IBinaryTreeNode

getValue

public T getValue()
Return the value for this node.


toString

public java.lang.String toString()
Return representation of this node.

Overrides:
toString in class java.lang.Object

nodeLabel

public java.lang.String nodeLabel()
Node Label for binary node. Note: Dispensed with idea of showing left/right and only focus on the value.

Specified by:
nodeLabel in interface IGraphEntity

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.