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
45 lines (36 loc) · 1.03 KB
/
BinaryTreeNode.java
File metadata and controls
45 lines (36 loc) · 1.03 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
package org.example.classes;
import org.example.generator.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 "BinaryTreeNode{" +
"data=" + data +
", left=" + (left != null ? "TreeNode(" + left.data + ")" : "null") +
", right=" + (right != null ? "TreeNode(" + right.data + ")" : "null") +
'}';
}
}