-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryNode.java
More file actions
52 lines (52 loc) · 1.07 KB
/
BinaryNode.java
File metadata and controls
52 lines (52 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public class BinaryNode {
private BinaryNode left;
private BinaryNode right;
private int x, y;
public int value;
private boolean isNull;
public BinaryNode(int v) {
value = v;
isNull = false;
}
public BinaryNode() {
isNull = true;
}
public String toString()
{
String temp = "Value:"+value+", Left:"+(left==null?null:left.value)+", Right:"+(right==null?null:right.value);
return temp;
}
public BinaryNode getLeft() {
return left;
}
public BinaryNode getRight() {
return right;
}
public int getValue() {
return value;
}
public void setLeft(BinaryNode n) {
left = n;
}
public void setRight(BinaryNode n) {
right = n;
}
public void setValue(int v) {
value = v;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public boolean isNull() {
return isNull;
}
}