Add the binary tree class code skeleton.
[TP_POO.git] / Arbres / ArbreBinaire.java
CommitLineData
d7dd93e3
JB
1
2/**
3 * Binary tree class.
4 * A binary tree is a ordered value tree with only two childs by node
5 */
6public class ArbreBinaire {
7
8 private class IntNode {
9 private int data;
10 private IntNode leftIntNode;
11 private IntNode rightIntNode;
12
13 IntNode(int value) {
14 setData(value);
15 setLeftNode(null);
16 setRightNode(null);
17 }
18
19 IntNode(int value, IntNode leftNode, IntNode rightNode) {
20 setData(value);
21 setLeftNode(leftNode);
22 setRightNode(rightNode);
23 }
24
25 private int getData() {
26 return data;
27 }
28
29 private void setData(int value) {
30 data = value;
31 }
32
33 private IntNode getLeftNode() {
34 return leftIntNode;
35 }
36
37 private void setLeftNode(IntNode leftNode) {
38 leftIntNode = leftNode;
39 }
40
41 private IntNode getRightNode() {
42 return rightIntNode;
43 }
44
45 private void setRightNode(IntNode rightNode) {
46 rightIntNode = rightNode;
47 }
48
49 }
50
51 private IntNode rootNode;
52
53 ArbreBinaire() {
54 setRootNode(null);
55 }
56
57 private void setRootNode(IntNode node) {
58 rootNode = node;
59 }
60
61 private IntNode getRootNode() {
62 return rootNode;
63 }
64
65 private boolean isEmpty() {
66 return (getRootNode() == null);
67 }
68
69 public void inserer(int value) {
70
71 }
72
73 public void supprimer(int value) {
74
75 }
76
77}