-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDecisionTreeNode.cpp
42 lines (40 loc) · 934 Bytes
/
DecisionTreeNode.cpp
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
#include "DecisionTreeNode.h"
/**
* Author: Alperen Öziş
* ID: 21703804
* Section: 1
* Assignment: 2 */
DecisionTreeNode::DecisionTreeNode() {
id = -1;
leftChildPtr = nullptr;
rightChildPtr = nullptr;
}
DecisionTreeNode::DecisionTreeNode(const int id1, DecisionTreeNode* left, DecisionTreeNode* right) {
id = id1;
leftChildPtr = left;
rightChildPtr = right;
}
DecisionTreeNode::~DecisionTreeNode() {
if (leftChildPtr)
delete leftChildPtr;
if (rightChildPtr)
delete rightChildPtr;
}
int DecisionTreeNode::getId() {
return id;
}
void DecisionTreeNode::setId(const int id1) {
id = id1;
}
DecisionTreeNode* DecisionTreeNode::getRightChild() {
return rightChildPtr;
}
DecisionTreeNode* DecisionTreeNode::getLeftChild() {
return leftChildPtr;
}
void DecisionTreeNode::setLeftChild(DecisionTreeNode* node) {
leftChildPtr = node;
}
void DecisionTreeNode::setRightChild(DecisionTreeNode* node) {
rightChildPtr = node;
}