-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeNode.java
More file actions
31 lines (26 loc) · 732 Bytes
/
TreeNode.java
File metadata and controls
31 lines (26 loc) · 732 Bytes
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
public class TreeNode
{
private Object value;
private TreeNode left;
private TreeNode right;
// Constructors:
public TreeNode(Object initValue)
{
value = initValue;
left = null;
right = null;
}
public TreeNode(Object initValue, TreeNode initLeft, TreeNode initRight)
{
value = initValue;
left = initLeft;
right = initRight;
}
// Methods:
public Object getValue() { return value; }
public TreeNode getLeft() { return left; }
public TreeNode getRight() { return right; }
public void setValue(Object theNewValue) { value = theNewValue; }
public void setLeft(TreeNode theNewLeft) { left = theNewLeft; }
public void setRight(TreeNode theNewRight) { right = theNewRight; }
}