Back

package com.futureshocked.datastructures;

/**
 * Simple node class to be used by {@link BinaryTree}.
 */
public class BinaryNode {
  /**
   * The value of this node.
   */
  private int data;

  /**
   * The left and right child nodes.
   */
  private BinaryNode leftNode, rightNode;

  /**
   * Simple constructor for BinaryNode.
   *
   * @param data The value of this node.
   */
  public BinaryNode(int data) {
    this.data = data;
  }

  public int getData() {
    return data;
  }

  public void setData(int data) {
    this.data = data;
  }

  public BinaryNode getLeftNode() {
    return leftNode;
  }

  public void setLeftNode(BinaryNode leftNode) {
    this.leftNode = leftNode;
  }

  public BinaryNode getRightNode() {
    return rightNode;
  }

  public void setRightNode(BinaryNode rightNode) {
    this.rightNode = rightNode;
  }

}

Top