-
Notifications
You must be signed in to change notification settings - Fork 0
/
ElectionAnalyser.cpp
39 lines (34 loc) · 999 Bytes
/
ElectionAnalyser.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
#include "ElectionAnalyser.h"
#include "Log.h"
#include "PartiesAnalyser.h"
#include "SwingAnalyser.h"
ElectionAnalyser::ElectionAnalyser(ElectionCollection const& elections)
: elections(elections)
{
}
void ElectionAnalyser::run(Type type, int electionFocus)
{
hasClusterAnalysis_ = false;
switch (type) {
case Type::Parties:
lastPartiesOutput = PartiesAnalyser(elections).run(electionFocus);
lastOutputString = PartiesAnalyser::getTextOutput(lastPartiesOutput);
case Type::Swing:
lastSwingOutput = SwingAnalyser(elections).run();
lastOutputString = SwingAnalyser::getTextOutput(lastSwingOutput);
break;
case Type::Cluster:
lastClusterOutput = ClusterAnalyser(elections).run();
lastOutputString = ClusterAnalyser::getTextOutput(lastClusterOutput);
hasClusterAnalysis_ = true;
break;
}
}
std::string ElectionAnalyser::textOutput() const
{
return lastOutputString;
}
ClusterAnalyser::Output const& ElectionAnalyser::clusterOutput() const
{
return lastClusterOutput;
}