generated from JavaLabs2025/reflection-template
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathBinaryTreeNode.java
More file actions
47 lines (38 loc) · 1.12 KB
/
BinaryTreeNode.java
File metadata and controls
47 lines (38 loc) · 1.12 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
package org.example.classes;
import org.example.annotations.Generatable;
@Generatable
public class BinaryTreeNode {
private Integer data;
private BinaryTreeNode left;
private BinaryTreeNode right;
public BinaryTreeNode(Integer data, BinaryTreeNode left, BinaryTreeNode right) {
this.data = data;
this.left = left;
this.right = right;
}
public Integer getData() {
return data;
}
public BinaryTreeNode getLeft() {
return left;
}
public BinaryTreeNode getRight() {
return right;
}
public void setLeft(BinaryTreeNode left) {
this.left = left;
}
public void setRight(BinaryTreeNode right) {
this.right = right;
}
@Override
public String toString() {
return new StringBuilder()
.append("BinaryTreeNode{")
.append("data=").append(data)
.append(", left=").append(left != null ? left.toString() : "null")
.append(", right=").append(right != null ? right.toString() : "null")
.append("}")
.toString();
}
}