Debian Codegraph @

Source/Test/Analyse/Reader/CClassificationStatisticsUpdateReader.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 "CClassificationStatisticsUpdateReader.h"
22
23
24 namespace Konclude {
25
26 namespace Test {
27
28 namespace Analyse {
29
30 namespace Reader {
31
32 CClassificationStatisticsUpdateReader::CClassificationStatisticsUpdateReader(CClassificationManager *classificationManager) {
33 classiMan = classificationManager;
34
35 pseudoModelMergedSubsumValueDescription = 0;
36 derivatedSubsumValueDescription = 0;
37 calculatedSubsumValueDescription = 0;
38 prunedSubsumValueDescription = 0;
39 subclassSubsumValueDescription = 0;
40 subclassIdOccSubsumValueDescription = 0;
41
42 statistics = new CClassifierStatistics();
43
44 if (classiMan) {
45 pseudoModelMergedSubsumValueDescription = new CAnalyseValueDescription();
46 pseudoModelMergedSubsumValueDescription->setValueName(QString("PseudoModelMergedTestedSubsumptionCount"));
47 pseudoModelMergedSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
48
49 subclassSubsumValueDescription = new CAnalyseValueDescription();
50 subclassSubsumValueDescription->setValueName(QString("SubclassTestedSubsumptionCount"));
51 subclassSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
52
53 subclassIdOccSubsumValueDescription = new CAnalyseValueDescription();
54 subclassIdOccSubsumValueDescription->setValueName(QString("SubclassIdentifierOccurTestedSubsumptionCount"));
55 subclassIdOccSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
56
57 derivatedSubsumValueDescription = new CAnalyseValueDescription();
58 derivatedSubsumValueDescription->setValueName(QString("DerivatedTestedSubsumptionCount"));
59 derivatedSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
60
61 calculatedSubsumValueDescription = new CAnalyseValueDescription();
62 calculatedSubsumValueDescription->setValueName(QString("CalculatedTestedSubsumptionCount"));
63 calculatedSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
64
65 prunedSubsumValueDescription = new CAnalyseValueDescription();
66 prunedSubsumValueDescription->setValueName(QString("PrunedTestedSubsumptionCount"));
67 prunedSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
68
69 toldSubsumValueDescription = new CAnalyseValueDescription();
70 toldSubsumValueDescription->setValueName(QString("ToldSubsumptionCount"));
71 toldSubsumValueDescription->setTemplateValue(new CIntegerAnalyseValue(0));
72 }
73 }
74
75 CClassificationStatisticsUpdateReader::~CClassificationStatisticsUpdateReader() {
76 if (pseudoModelMergedSubsumValueDescription) {
77 delete pseudoModelMergedSubsumValueDescription;
78 }
79 if (derivatedSubsumValueDescription) {
80 delete derivatedSubsumValueDescription;
81 }
82 if (calculatedSubsumValueDescription) {
83 delete calculatedSubsumValueDescription;
84 }
85 if (prunedSubsumValueDescription) {
86 delete prunedSubsumValueDescription;
87 }
88 if (subclassSubsumValueDescription) {
89 delete subclassSubsumValueDescription;
90 }
91 if (subclassIdOccSubsumValueDescription) {
92 delete subclassIdOccSubsumValueDescription;
93 }
94 if (toldSubsumValueDescription) {
95 delete toldSubsumValueDescription;
96 }
97 if (statistics) {
98 delete statistics;
99 }
100 }
101
102
103
104 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getPseudoModelMergedTestedSubsumptionCountValueDescription() {
105 return pseudoModelMergedSubsumValueDescription;
106 }
107
108
109 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getDerivatedTestedSubsumptionCountValueDescription() {
110 return derivatedSubsumValueDescription;
111 }
112
113 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getCalculatedTestedSubsumptionCountValueDescription() {
114 return calculatedSubsumValueDescription;
115 }
116
117 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getPrunedTestedSubsumptionCountValueDescription() {
118 return prunedSubsumValueDescription;
119 }
120
121 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getSubclassTestedSubsumptionCountValueDescription() {
122 return subclassSubsumValueDescription;
123 }
124
125 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getSubclassIdentifierOccurTestedSubsumptionCountValueDescription() {
126 return subclassIdOccSubsumValueDescription;
127 }
128
129 CAnalyseValueDescription *CClassificationStatisticsUpdateReader::getToldSubsumptionCountValueDescription() {
130 return toldSubsumValueDescription;
131 }
132
133
134 CAnalyseValue *CClassificationStatisticsUpdateReader::getAnalyseValueUpdate(CAnalyseValueDescription *valueDes) {
135 CAnalyseValue *val = 0;
136 statistics->resetValues();
137
138 if (valueDes == pseudoModelMergedSubsumValueDescription && classiMan) {
139 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getPseudoModelMergedTestedSubsumptionCount());
140 } else if (valueDes == derivatedSubsumValueDescription && classiMan) {
141 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getDerivatedTestedSubsumptionCount());
142 } else if (valueDes == calculatedSubsumValueDescription && classiMan) {
143 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getCalculatedTestedSubsumptionCount());
144 } else if (valueDes == prunedSubsumValueDescription && classiMan) {
145 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getPrunedTestedSubsumptionCount());
146 } else if (valueDes == subclassSubsumValueDescription && classiMan) {
147 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getSubclassTestedSubsumptionCount());
148 } else if (valueDes == subclassIdOccSubsumValueDescription && classiMan) {
149 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getSubclassIdentifierOccurTestedSubsumptionCount());
150 } else if (valueDes == toldSubsumValueDescription && classiMan) {
151 val = new CIntegerAnalyseValue(classiMan->collectClassificationStatistics(statistics)->getToldSubsumptionCount()-statistics->getCalculatedTestedSubsumptionCount());
152 }
153 return val;
154 }
155
156
157
158 }; // end namespace Reader
159
160 }; // end namespace Analyse
161
162 }; // end namespace Test
163
164 }; // end namespace Konclude