-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.cpp
81 lines (69 loc) · 1.04 KB
/
node.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "node.h"
#include <iostream>
#include <string>
using namespace std;
node::node()
{
myLabel="unknown";
mySplitVal=0;
myLeafNode=false;
mySplitValAttr=-1;
}
void node::setLabel(string label)
{
myLabel=label;
}
string node::getLabel()
{
return myLabel;
}
void node::setSplitVal(float splitVal)
{
mySplitVal=splitVal;
}
float node::getSplitVal()
{
return mySplitVal;
}
void node::setData(vector<float> data, int N)
{
for(int i=0; i<N; i++)
{
myData.push_back(data.at(i));
}
}
void node::printData()
{
for(int i=0; i<myData.size(); i++)
{
cout<<myData.at(i)<<" ";
}
cout<<endl;
}
node * node::getLeftNode()
{
return myLeftNode;
}
node * node::getRightNode()
{
return myRightNode;
}
void node::setLeafNode(bool leafNode)
{
myLeafNode=leafNode;
}
bool node::getLeafNode()
{
return myLeafNode;
}
void node::setSplitValAttr(int splitValAttr)
{
mySplitValAttr=splitValAttr;
}
int node::getSplitValAttr()
{
return mySplitValAttr;
}
node::~node()
{
}