Algorithm
Development Kit 1.0

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

java.lang.Object
  extended by algs.model.tree.BinaryNode
      extended by algs.model.tree.RightThreadedBinaryNode<T>
Type Parameters:
T -
All Implemented Interfaces:
IGraphEntity, IBinaryTreeNode

public class RightThreadedBinaryNode<T extends java.lang.Comparable>
extends BinaryNode

A RightThreadedBinaryNode adds a 'thread' link to the successor node in the Binary Tree for the given node.

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
RightThreadedBinaryNode(java.lang.Comparable value)
          Construct a node to belong in a right-threaded binary tree.
 
Method Summary
 RightThreadedBinaryNode<T> getLeftSon()
          Return the left son associated with this node.
 RightThreadedBinaryNode<T> getNext()
          Returns the next node in the tree via the thread (or null).
 RightThreadedBinaryNode<T> getRightSon()
          Return the right son associated with this node.
 boolean isThread()
          Determines if this node is indeed maintaining a forward-pointer to the next in tree.
 java.lang.String nodeLabel()
          Expose threaded value in the node label.
 
Methods inherited from class algs.model.tree.BinaryNode
getValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RightThreadedBinaryNode

public RightThreadedBinaryNode(java.lang.Comparable value)
Construct a node to belong in a right-threaded binary tree.

Parameters:
value - Value to be inserted.
Method Detail

isThread

public boolean isThread()
Determines if this node is indeed maintaining a forward-pointer to the next in tree.

Returns:
true if this node is a right-thread node

getLeftSon

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

Specified by:
getLeftSon in interface IBinaryTreeNode
Overrides:
getLeftSon in class BinaryNode

getRightSon

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

Specified by:
getRightSon in interface IBinaryTreeNode
Overrides:
getRightSon in class BinaryNode

getNext

public RightThreadedBinaryNode<T> getNext()
Returns the next node in the tree via the thread (or null).


nodeLabel

public java.lang.String nodeLabel()
Expose threaded value in the node label.

Specified by:
nodeLabel in interface IGraphEntity
Overrides:
nodeLabel in class BinaryNode

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.