-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodgeneral.cpp
95 lines (79 loc) · 2.89 KB
/
modgeneral.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
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "modgeneral.h"
modGeneral::modGeneral(QWidget *parent) :
EvgBasicModel(CountGeneral,
parent,
tr("qrc:/models/general"),
tr("Узагальнююча Модель"),
tr(""),
1)
{
setCofficientName();
}
void modGeneral::setRowsDefinitions()
{
// Job of this function makes next func.
// void modGeneral::setCofficientName()
// Thanks for it! :-)
}
void modGeneral::setCofficientName()
{
QString MODELS_NAMES[] = {tr("Модель Альтмана 1983 р."),
tr("Модель Г. Спрінгейта"),
tr("Модель Р. Таффлера"),
tr("Модель Р. Ліса"),
tr("Коефіцієнт У. Бівера"),
tr("Модель Давидової-Бєлікова"),
tr("Модель Сайфулліна і Кадикова"),
tr("Модель Савицької"),
tr("Модель Терещенка"),
tr("Модель Чупіса"),
tr("Узагальнююча оцінка")};
for (int i = 0; i < count; i++)
{
pCoefficientRows[i]->changeIdToText(MODELS_NAMES[i]);
pCoefficientRows[i]->setStringByState(TypeStateUndefined);
}
}
void modGeneral::createTopLayout()
{
pLabelResult->hide();
pLabelFormula->hide();
topLayout = new QHBoxLayout;
}
void modGeneral::createCentralLayout()
{
EvgBasicModel::createCentralLayout();
centralGrid->setSpacing(10);
}
void modGeneral::calculate(EvgBasicModel *pInputData)
{
if (this != pInputData)
{
qDebug("Error in modGeneral::%s", __FUNCTION__);
return;
}
result = (pCoefficientRows[0]->getValue()/2.065
+ pCoefficientRows[1]->getValue()/ 0.862
+ pCoefficientRows[2]->getValue()/ 0.25
+ pCoefficientRows[3]->getValue()/ 0.037
+ pCoefficientRows[4]->getValue()/ 0.31
+ pCoefficientRows[5]->getValue()/ 0.25
+ pCoefficientRows[6]->getValue()
- pCoefficientRows[7]->getValue()/ 0.5
+ pCoefficientRows[8]->getValue()/ 0.16
- pCoefficientRows[9]->getValue()) / 10;
pCoefficientRows[10]->setValue(result);
if (result < -0.434)
_state = TypeStateUnstable;
else if (result >= -0.434 && result <= 1.234)
_state = TypeStateMiddle;
else
_state = TypeStateStable;
pCoefficientRows[10]->setStringByState(_state);
}
void modGeneral::calculate(int number, EvgBasicModel *model)
{
pCoefficientRows[number-1]->setValue(model->getResult());
pCoefficientRows[number-1]->setStringByState(model->getState());
calculate(this);
}