Create a generic Node class and make use of it.
[TP_POO.git] / Arbres / Node.java
1 public class Node<E> {
2 private E data;
3 private Node<E> leftNode;
4 private Node<E> rightNode;
5
6 Node(E value) {
7 setData(value);
8 setLeftNode(null);
9 setRightNode(null);
10 }
11
12 Node(E value, Node<E> leftNode, Node<E> rightNode) {
13 setData(value);
14 setLeftNode(leftNode);
15 setRightNode(rightNode);
16 }
17
18 public E getData() {
19 return data;
20 }
21
22 public void setData(E value) {
23 data = value;
24 }
25
26 public Node<E> getLeftNode() {
27 return leftNode;
28 }
29
30 public void setLeftNode(Node<E> Node) {
31 leftNode = Node;
32 }
33
34 public Node<E> getRightNode() {
35 return rightNode;
36 }
37
38 public void setRightNode(Node<E> Node) {
39 rightNode = Node;
40 }
41
42 }