Initial
This commit is contained in:
42
Node.java
Normal file
42
Node.java
Normal file
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user