-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBTNode.java
57 lines (45 loc) · 1.2 KB
/
BTNode.java
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
53
54
55
56
57
/**
* Write a description of class BTNode here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BTNode<T> implements java.io.Serializable { // Bounded to ensure only extended classes are able to instantiate
private BTNode<T> left;
private BTNode<T> right;
private T value = null;
/**
* Default constructor
*/
public BTNode() {
}
public BTNode(T value) {
this.value = value;
}
public BTNode(T value, BTNode<T> leftChild, BTNode<T> rightChild ) {
this.left= leftChild; /// verify this works
this.right = rightChild;
this.value = value;
}
public void setLeftChild(BTNode<T> left) {
this.left = left;
}
public void setRightChild(BTNode<T> right) {
this.right = right;
}
public BTNode<T> getLeftChild() {
return this.left;
}
public BTNode<T> getRightChild() {
return this.right;
}
public T getValue() {
return this.value;
}
public void setValue(T value) {
this.value = value;
}
public String toString() {
return null;
}
}