Add the binary tree class code skeleton.
[TP_POO.git] / Arbres / ArbreBinaire.java
diff --git a/Arbres/ArbreBinaire.java b/Arbres/ArbreBinaire.java
new file mode 100644 (file)
index 0000000..8365312
--- /dev/null
@@ -0,0 +1,77 @@
+
+/**
+ * Binary tree class.
+ * A binary tree is a ordered value tree with only two childs by node
+ */
+public class ArbreBinaire {
+
+    private class IntNode {
+        private int data;
+        private IntNode leftIntNode;
+        private IntNode rightIntNode;
+
+        IntNode(int value) {
+            setData(value);
+            setLeftNode(null);
+            setRightNode(null);
+        }
+
+        IntNode(int value, IntNode leftNode, IntNode rightNode) {
+            setData(value);
+            setLeftNode(leftNode);
+            setRightNode(rightNode);
+        }
+
+        private int getData() {
+            return data;
+        }
+
+        private void setData(int value) {
+            data = value;
+        }
+
+        private IntNode getLeftNode() {
+            return leftIntNode;
+        }
+
+        private void setLeftNode(IntNode leftNode) {
+            leftIntNode = leftNode;
+        }
+
+        private IntNode getRightNode() {
+            return rightIntNode;
+        }
+
+        private void setRightNode(IntNode rightNode) {
+            rightIntNode = rightNode;
+        }
+
+    }
+
+    private IntNode rootNode;
+
+    ArbreBinaire() {
+        setRootNode(null);
+    }
+
+    private void setRootNode(IntNode node) {
+        rootNode = node;
+    }
+
+    private IntNode getRootNode() {
+        return rootNode;
+    }
+
+    private boolean isEmpty() {
+        return (getRootNode() == null);
+    }
+
+    public void inserer(int value) {
+
+    }
+
+    public void supprimer(int value) {
+
+    }
+
+}