Debian Codegraph @

Source/Test/Analyse/Reader/CClassificationProgressUpdateReader.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CClassificationProgressUpdateReader.h"
22
23
24 namespace Konclude {
25
26 namespace Test {
27
28 namespace Analyse {
29
30 namespace Reader {
31
32 CClassificationProgressUpdateReader::CClassificationProgressUpdateReader(CClassificationManager *classificationManager) {
33 classiMan = classificationManager;
34
35 totalSubsumValueDescription = 0;
36 totalSatisValueDescription = 0;
37 testedSubsumValueDescription = 0;
38 testedSatisValueDescription = 0;
39 activeClassifierCountValueDescription = 0;
40
41 statistics = new CClassifierStatistics();
42
43 if (classiMan) {
44 totalSubsumValueDescription = new CAnalyseValueDescription();
45 totalSubsumValueDescription->setValueName(QString("ClassificationManager::TotalSubsumptionTestCount"));
46 totalSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
47
48 totalSatisValueDescription = new CAnalyseValueDescription();
49 totalSatisValueDescription->setValueName(QString("ClassificationManager::TotalSatisfiableTestCount"));
50 totalSatisValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
51
52 testedSubsumValueDescription = new CAnalyseValueDescription();
53 testedSubsumValueDescription->setValueName(QString("ClassificationManager::TestedSubsumptionCount"));
54 testedSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
55
56 testedSatisValueDescription = new CAnalyseValueDescription();
57 testedSatisValueDescription->setValueName(QString("ClassificationManager::TestedSatisfiableCount"));
58 testedSatisValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
59
60 activeClassifierCountValueDescription = new CAnalyseValueDescription();
61 activeClassifierCountValueDescription->setValueName(QString("ClassificationManager::ActiveClassifierCount"));
62 activeClassifierCountValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
63 }
64 }
65
66 CClassificationProgressUpdateReader::~CClassificationProgressUpdateReader() {
67 if (totalSubsumValueDescription) {
68 delete totalSubsumValueDescription;
69 }
70 if (totalSatisValueDescription) {
71 delete totalSatisValueDescription;
72 }
73 if (testedSubsumValueDescription) {
74 delete testedSubsumValueDescription;
75 }
76 if (testedSatisValueDescription) {
77 delete testedSatisValueDescription;
78 }
79 if (activeClassifierCountValueDescription) {
80 delete activeClassifierCountValueDescription;
81 }
82 if (statistics) {
83 delete statistics;
84 }
85 }
86
87
88
89 CAnalyseValueDescription *CClassificationProgressUpdateReader::getTotalSubsumptionTestCountValueDescription() {
90 return totalSubsumValueDescription;
91 }
92
93
94 CAnalyseValueDescription *CClassificationProgressUpdateReader::getTestedSubsumptionCountValueDescription() {
95 return testedSubsumValueDescription;
96 }
97
98 CAnalyseValueDescription *CClassificationProgressUpdateReader::getTotalSatisfiableTestCountValueDescription() {
99 return totalSatisValueDescription;
100 }
101
102 CAnalyseValueDescription *CClassificationProgressUpdateReader::getTestedSatisfiableCountValueDescription() {
103 return testedSatisValueDescription;
104 }
105
106 CAnalyseValueDescription *CClassificationProgressUpdateReader::getActiveClassifierCountValueDescription() {
107 return activeClassifierCountValueDescription;
108 }
109
110
111
112 CAnalyseValue *CClassificationProgressUpdateReader::getAnalyseValueUpdate(CAnalyseValueDescription *valueDes) {
113 CAnalyseValue *val = 0;
114 statistics->resetValues();
115
116 if (valueDes == totalSubsumValueDescription && classiMan) {
117 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getTotalSubsumptionTestCount());
118 } else if (valueDes == totalSatisValueDescription && classiMan) {
119 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getTotalSatisfiableCount());
120 } else if (valueDes == testedSubsumValueDescription && classiMan) {
121 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getTestedSubsumptionCount());
122 } else if (valueDes == testedSatisValueDescription && classiMan) {
123 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getTestedSatisfiableCount());
124 } else if (valueDes == activeClassifierCountValueDescription && classiMan) {
125 val = new CIntegerAnalyseValue(classiMan->getActiveClassifierCount());
126 }
127 return val;
128 }
129
130
131
132 }; // end namespace Reader
133
134 }; // end namespace Analyse
135
136 }; // end namespace Test
137
138 }; // end namespace Konclude