-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobotNode.java
81 lines (73 loc) · 1.68 KB
/
RobotNode.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* The RobotNode class creates a node representative of a Robot object
* in order to be used in RobotTree.
*
* @author Akshara Ganapathi, Mukund Ramachandran, Sanjeet Verma
* Collaborators: None
* Teacher Name: Ms. Bailey
* Period: 03/05
* Due Date: 05-19-22
*/
public class RobotNode {
private Robot value;
private RobotNode left;
private RobotNode right;
/**
* Constructs a node with the given initValue and no children
*
* @param initValue the value to store in node
*/
public RobotNode(Robot initValue) {
value = initValue;
left = null;
right = null;
}
/**
* Returns the Robot object
*
* @return Robot object
*/
public Robot getValue() {
return value;
}
/**
* Returns the left child
*
* @return left child node
*/
public RobotNode getLeft() {
return left;
}
/**
* Returns the right child
*
* @return right child node
*/
public RobotNode getRight() {
return right;
}
/**
* Change the value in the node
*
* @param theNewValue new value
*/
public void setValue(Robot theNewValue) {
value = theNewValue;
}
/**
* Points the node to a different left node
*
* @param theNewLeft new left node
*/
public void setLeft(RobotNode theNewLeft) {
left = theNewLeft;
}
/**
* Points the node to a different right node
*
* @param theNewRight new right node
*/
public void setRight(RobotNode theNewRight) {
right = theNewRight;
}
}