-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStatistics.h
387 lines (296 loc) · 10.5 KB
/
Statistics.h
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
#ifndef STATISTICS_H
#define STATISTICS_H
#include "Parameters.h"
#include "Agent.h"
#include <QString>
#include <QVector>
#include "qcustomplot.h"
class Skeleton;
class Family;
class QWidget;
class Agent;
class Statistics
{
public:
Statistics(QWidget *parent, AgentList &_agentListFinal, int inNumBoro, int inNumAge, int inNumRace, int inNumIncome, int inNumAgents);
virtual ~Statistics();
void demographicStats();
QString outString;
protected:
void counterAgeByBorough(unsigned int i);
void counterRaceByBorough(unsigned int i);
void counterIncomeByBorough(unsigned int i);
void counterUtilityLossByBorough(unsigned int i);
void counterDamageTypeByBorough(unsigned int i);
void counterDisplacementByBorough(unsigned int i);
void counterFinancialLossByBorough(unsigned int i);
void counterPTSDstatusByBorough(unsigned int i);
void setBarGraphProperties(QCPBars *bar, double width, unsigned int j);
void setAxisDemoBarGraph();
void setAxisSandyDamageBarGraph();
void setAxisProperties(QCustomPlot *plot, const QString xLabel, const QString yLabel, const QString legendPosition, bool legendShow, int index, int size);
void displayBarGraph(QWidget *plot, QCustomPlot *bar1, QCustomPlot *bar2, QCustomPlot *bar3, QCustomPlot *bar4);
protected:
AgentList agentListFinal;
//FamilyList familyList;
unsigned short int numBoro;
unsigned short int numAge;
unsigned short int numRace;
unsigned short int numIncome;
int numAgents;
unsigned short int numDamageType;
unsigned short int numLeftHome;
unsigned short int numPTSDstatus;
unsigned short int numFinLossType;
boost::container::vector<int> populationCount;
boost::container::vector<int> ageCount;
boost::container::vector<int> raceCount;
boost::container::vector<int> incCount;
boost::container::vector<int> elecLossCount;
boost::container::vector<int> waterLossCount;
boost::container::vector<int> heatLossCount;
boost::container::vector<int> damageTypeCount;
boost::container::vector<int> leftHomeCount;
boost::container::vector<int> ptsdStatusCount;
boost::container::vector<int> finLossTypeCount;
QSharedPointer<QCPAxisTickerText> textTicker;
QWidget *plot1;
QCustomPlot *popChart;
QCustomPlot *ageChart;
QCustomPlot *raceChart;
QCustomPlot *incomeChart;
QWidget *plot2;
QCustomPlot *utilityLossChart;
QCustomPlot *displacementChart;
QCustomPlot *damageChart;
QCustomPlot *financialLossChart;
QVector<int> red;
QVector<int> green;
QVector<int> blue;
QVector <QString> boroLabels;
QVector <double> ticks;
};
struct Check_Borough
{
unsigned short int borough;
Check_Borough(int inBoro) : borough(inBoro){}
bool operator()(Agent &a){
return a.getBorough() == borough;
}
};
struct Check_Race
{
unsigned short int borough;
unsigned short int race;
Check_Race(int inBoro, int inRace) : borough(inBoro), race(inRace){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getRace() == race);
}
};
struct Check_Age
{
unsigned short int borough;
unsigned short int ageCat;
Check_Age(int inBoro, int inAge) : borough(inBoro), ageCat(inAge){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getAgeCat() == ageCat);
}
};
struct Check_Income
{
unsigned short int borough;
int income;
Check_Income(unsigned short int inBoro, int inIncome) : borough(inBoro), income(inIncome){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getIncome() == income);
}
};
struct Check_Electric_Loss
{
unsigned short int borough;
unsigned short int elecLoss;
Check_Electric_Loss(unsigned short int inBoro, unsigned short int inElecLoss) : borough(inBoro), elecLoss(inElecLoss){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getElectricLoss() == elecLoss);
}
};
struct Check_Heat_Loss
{
unsigned short int borough;
unsigned short int heatLoss;
Check_Heat_Loss(unsigned short int inBoro, unsigned short int inHeatLoss) : borough(inBoro), heatLoss(inHeatLoss){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getHeatLoss() == heatLoss);
}
};
struct Check_Water_Loss
{
unsigned short int borough;
unsigned short int waterLoss;
Check_Water_Loss(unsigned short int inBoro, unsigned short int inWaterLoss) : borough(inBoro), waterLoss(inWaterLoss){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getWaterLoss() == waterLoss);
}
};
struct Check_Damage_Type
{
unsigned short int borough;
unsigned short int damageType;
Check_Damage_Type(unsigned short int inBoro, unsigned short int inDamage) : borough(inBoro), damageType(inDamage){}
bool operator() (Agent &a){
return (a.getBorough() == borough && a.getDamage() == damageType);
}
};
struct Check_Displacement
{
unsigned short int borough;
unsigned short int leftHome;
Check_Displacement(unsigned short int inBoro, unsigned short int inLeftHome) : borough(inBoro), leftHome(inLeftHome){}
bool operator() (Agent &a){
return(a.getBorough() == borough && a.getLeftHome() == leftHome);
}
};
struct Check_Financial_loss
{
unsigned short int borough;
unsigned short int finLossType;
Check_Financial_loss(unsigned short int inBoro, unsigned short int inFinLoss) : borough(inBoro), finLossType(inFinLoss){}
bool operator () (Agent &a){
return(a.getBorough() == borough && a.getFinancialLossType() == finLossType);
}
};
struct Check_PTSD_Status
{
unsigned short int borough;
unsigned short int statusPTSD;
Check_PTSD_Status(unsigned short int inBoro, unsigned short int inPTSDstatus) : borough(inBoro), statusPTSD(inPTSDstatus){}
bool operator() (Agent &a) {
return(a.getBorough() == borough && a.getPTSDstatus() == statusPTSD);
}
};
struct Check_PTSDx_SC
{
unsigned short int incomeLoss;
Check_PTSDx_SC(unsigned short int inIncomeLoss) :incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDsymptom() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_Resolved_PTSD_SC
{
unsigned short int incomeLoss;
Check_Resolved_PTSD_SC(unsigned short int inIncomeLoss) : incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDresolvedSC() && a.getInitialPTSDsymptom() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_PTSDx_SC_NO_SW
{
unsigned short int incomeLoss;
Check_PTSDx_SC_NO_SW(unsigned short int inIncomeLoss) : incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDsymptomNoSW() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_Resolved_PTSD_SC_NO_SW
{
unsigned short int incomeLoss;
Check_Resolved_PTSD_SC_NO_SW(unsigned short int inIncomeLoss) : incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDresolvedSCNoSW() && a.getInitialPTSDsymptom() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_PTSDx_UC
{
unsigned short int incomeLoss;
Check_PTSDx_UC(unsigned short int inIncomeLoss) :incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDsymptomUC() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_Resolved_PTSD_UC
{
unsigned short int incomeLoss;
Check_Resolved_PTSD_UC(unsigned short int inIncomeLoss) : incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getPTSDresolvedUC() && a.getInitialPTSDsymptom() > PTSD_CUT_OFF && a.getIncomeDeclineT0()== incomeLoss);
}
};
struct Check_IncomeLoss
{
unsigned short int incomeLoss;
unsigned short int borough;
Check_IncomeLoss(unsigned short int inBoro, unsigned short int inIncomeLoss) : borough(inBoro), incomeLoss(inIncomeLoss){}
bool operator() (Agent &a) {
return(a.getBorough() == borough && a.getIncomeDeclineT0() == incomeLoss);
}
};
struct Check_State_SC
{
unsigned short int state;
Check_State_SC(unsigned short int inState) : state(inState){}
bool operator() (Agent &a){
return a.getAgentState() == state;
}
};
struct Check_State_SC_NoSW
{
unsigned short int state;
Check_State_SC_NoSW(unsigned short int inState) : state(inState){}
bool operator() (Agent &a){
return a.getAgentStateNoSW() == state;
}
};
struct Check_State_UC
{
unsigned short int state;
Check_State_UC(unsigned short int inState) : state(inState){}
bool operator() (Agent &a){
return a.getAgentStateUC() == state;
}
};
struct Check_IncDecline_Gender_Age
{
unsigned short int incDecline;
unsigned short int gender;
unsigned short int ageCat;
Check_IncDecline_Gender_Age(unsigned short int inIncDecline, unsigned short int inGender, unsigned short int inAgeCat) : incDecline(inIncDecline), gender(inGender), ageCat(inAgeCat){}
bool operator() (Agent &a) {
return(a.getIncomeDeclineT0() == incDecline && a.getGender()== gender && a.getAgeCat() == ageCat);
}
};
struct Check_IncDecline_Gender_Age_PTSD
{
unsigned short int incDecline;
unsigned short int gender;
unsigned short int ageCat;
unsigned short int PTSDstatus;
Check_IncDecline_Gender_Age_PTSD(unsigned short int inIncDecline, unsigned short int inGender, unsigned short int inAgeCat, unsigned short int inPTSDstatus ) :
incDecline(inIncDecline), gender(inGender), ageCat(inAgeCat), PTSDstatus(inPTSDstatus){}
bool operator() (Agent &a) {
return(a.getIncomeDeclineT0() == incDecline && a.getGender()== gender && a.getAgeCat() == ageCat && a.getPTSDstatus() == PTSDstatus);
}
};
struct Check_LeftHome_Gender_Age
{
unsigned short int leftHome;
unsigned short int gender;
unsigned short int ageCat;
Check_LeftHome_Gender_Age(unsigned short int inLeftHome, unsigned short int inGender, unsigned short int inAgeCat) : leftHome(inLeftHome), gender(inGender), ageCat(inAgeCat){}
bool operator() (Agent &a) {
return(a.getLeftHomeT0() == leftHome && a.getGender()== gender && a.getAgeCat() == ageCat);
}
};
struct Check_LeftHome_Gender_Age_PTSD
{
unsigned short int leftHome;
unsigned short int gender;
unsigned short int ageCat;
unsigned short int PTSDstatus;
Check_LeftHome_Gender_Age_PTSD(unsigned short int inLeftHome, unsigned short int inGender, unsigned short int inAgeCat, unsigned short int inPTSDstatus) :
leftHome(inLeftHome), gender(inGender), ageCat(inAgeCat), PTSDstatus(inPTSDstatus) {}
bool operator() (Agent &a) {
return(a.getLeftHomeT0() == leftHome && a.getGender()== gender && a.getAgeCat() == ageCat && a.getPTSDstatus() == PTSDstatus);
}
};
#endif STATISTICS_H