tree
Class MyNode

java.lang.Object
  |
  +--tree.MyNode

public class MyNode
extends java.lang.Object

This is a node in a binary search tree. The node holds an integer value.

See Also:
MyTree

Constructor Summary
MyNode(int value)
          Class constructor initializing this node's value.
 
Method Summary
 int calcSize()
          Calculate the size this subtree.
 MyNode getFather()
          Gets the father of this node.
 MyNode getLeftChild()
          Gets the left child of this node.
 MyNode getRightChild()
          Gets the right child of this node.
 int getValue()
          Gets the value of this node.
 void setFather(MyNode father)
          Sets the father of this node.
 void setLeftChild(MyNode left)
          Sets the left child of this node.
 void setRightChild(MyNode right)
          Sets the right child of this node.
 void setValue(int value)
          Sets the vlaue of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyNode

public MyNode(int value)
Class constructor initializing this node's value.
Parameters:
value - The value of this node.
Method Detail

getValue

public int getValue()
Gets the value of this node.
Returns:
The current value of this node.

setValue

public void setValue(int value)
Sets the vlaue of this node.
Parameters:
value - The new value of this node.

getFather

public MyNode getFather()
Gets the father of this node.
Returns:
The current father of this node.

setFather

public void setFather(MyNode father)
Sets the father of this node.
Parameters:
father - The new father of this node.

getRightChild

public MyNode getRightChild()
Gets the right child of this node.
Returns:
The current right child of this node.

setRightChild

public void setRightChild(MyNode right)
Sets the right child of this node.
Parameters:
right - The new right child of this node.

getLeftChild

public MyNode getLeftChild()
Gets the left child of this node.
Returns:
The current left child of this node.

setLeftChild

public void setLeftChild(MyNode left)
Sets the left child of this node.
Parameters:
left - The new left child of this node.

calcSize

public int calcSize()
Calculate the size this subtree. Recursively calculate the size of the subtree in which this node is the root.
Returns:
The size of the subtree.