43 lines
679 B
Java
43 lines
679 B
Java
public class Node {
|
|
private int content;
|
|
private Node leftNode;
|
|
private Node rightNode;
|
|
|
|
public Node() {}
|
|
|
|
public Node(int content) {
|
|
setContent(content);
|
|
}
|
|
|
|
public int getContent() {
|
|
return content;
|
|
}
|
|
|
|
public void setContent(int content) {
|
|
this.content = content;
|
|
}
|
|
|
|
public Node getLeftNode() {
|
|
return leftNode;
|
|
}
|
|
|
|
public Node getRightNode() {
|
|
return rightNode;
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
if (leftNode == null && rightNode == null) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void setRightNode(Node node) {
|
|
rightNode = node;
|
|
}
|
|
|
|
public void setLeftNode(Node node) {
|
|
leftNode = node;
|
|
}
|
|
}
|