-
Notifications
You must be signed in to change notification settings - Fork 0
/
concept.cpp
53 lines (42 loc) · 1.01 KB
/
concept.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
// Author: Kristi Daigh
// Project: MLEM2 Rule Induction
// Date: 11/20/2019
/** Source file for the concept object.
@file concept.cpp */
#include "concept.hpp"
using namespace std;
Concept::Concept(string d, string v)
: m_decision(d), m_value(v) {}
string Concept::getDecision() const {
return m_decision;
}
string Concept::getValue() const {
return m_value;
}
set<int> Concept::getBlock() const {
return m_block;
}
size_t Concept::getBlockSize() const {
return m_block.size();
}
void Concept::addCase(int c){
m_block.insert(c);
}
string Concept::toString(){
stringstream stream;
stream << "[(" << m_decision << ", " << m_value << ")] = {";
unsigned index = 0;
for(int x : m_block){
stream << x;
if(index + 1 != m_block.size()){
stream << ", ";
}
}
stream << "}";
return stream.str();
}
string Concept::labelString(){
stringstream stream;
stream << "(" << m_decision << ", " << m_value << ")";
return stream.str();
}