-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree_class.js
57 lines (47 loc) · 1.14 KB
/
tree_class.js
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
48
49
50
51
52
53
54
55
56
57
module.exports = class Node {
constructor(content) {
this.content = content;
this.operator = false;
if (content == 'OR' || content == 'AND') {
this.operator = true;
this.left = new Node(null);
this.left.content = null;
this.left.operator = null;
this.right = new Node(null);
this.right.content = null;
this.right.operator = null;
} else if (content == 'NOT') {
this.operator = true;
this.child = new Node(null);
this.child.content = null;
this.child.operator = null;
} else if (content == 'IMP') {
this.operator = true;
this.ant = new Node(null);
this.ant.content = null;
this.ant.operator = null;
this.con = new Node(null);
this.con.content = null;
this.con.operator = null;
}
}
}
// module.exports = class Tree {
//
// constructor() {
// this.root = null;
// }
//
// insert(data,type) {
//
// var newNode = new Node(data,type);
//
// if (this.root==null) {
// this.root = newNode
// } else {
// this.insertNode(this.root, newNode);
// }
//
//
// }
// }