T
- Any object which implements the Comparable interface is acceptedpublic class BinarySearchNode<T extends java.lang.Comparable<T>>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private T |
data |
private BinarySearchNode<T> |
leftChild |
private BinarySearchNode<T> |
parent |
private BinarySearchNode<T> |
rightChild |
Constructor and Description |
---|
BinarySearchNode(BinarySearchNode<T> parent,
BinarySearchNode<T> leftChild,
BinarySearchNode<T> rightChild,
T data) |
Modifier and Type | Method and Description |
---|---|
T |
getData() |
BinarySearchNode<T> |
getLeftChild() |
BinarySearchNode<T> |
getParent() |
BinarySearchNode<T> |
getRightChild() |
void |
setData(T data) |
void |
setLeftChild(BinarySearchNode<T> leftChild) |
void |
setParent(BinarySearchNode<T> parent) |
void |
setRightChild(BinarySearchNode<T> rightChild) |
java.lang.String |
toString()
Returns a string representation of the object.
|
private BinarySearchNode<T extends java.lang.Comparable<T>> parent
private BinarySearchNode<T extends java.lang.Comparable<T>> leftChild
private BinarySearchNode<T extends java.lang.Comparable<T>> rightChild
public BinarySearchNode(BinarySearchNode<T> parent, BinarySearchNode<T> leftChild, BinarySearchNode<T> rightChild, T data)
public BinarySearchNode<T> getParent()
public void setParent(BinarySearchNode<T> parent)
parent
- the new parent node to be setpublic BinarySearchNode<T> getLeftChild()
public void setLeftChild(BinarySearchNode<T> leftChild)
leftChild
- the new left chilad node to be setpublic BinarySearchNode<T> getRightChild()
public void setRightChild(BinarySearchNode<T> rightChild)
rightChild
- the new right child node to be setpublic T getData()
public void setData(T data)
data
- the new data object to be setpublic java.lang.String toString()
java.lang.Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class java.lang.Object