-
Notifications
You must be signed in to change notification settings - Fork 9
/
curve.h
81 lines (63 loc) · 1.79 KB
/
curve.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
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
class Curve {
public:
// =========================
// CONSTRUCTOR
Curve() {
add("PERFECT",-1,-1);
add("AVERAGE",-1,-1);
}
static Curve* DataStructuresCurve() {
Curve *curve = new Curve();
curve->add("LOWEST A-", 0.30, -1);
curve->add("LOWEST B-", 0.30, -1);
curve->add("LOWEST C-", 0.30, -1);
curve->add("LOWEST D", -1, 0.5);
return curve;
}
static Curve* TypicalCurve() {
Curve *curve = new Curve();
curve->add("LOWEST A-", -1, 0.9);
curve->add("LOWEST B-", -1, 0.8);
curve->add("LOWEST C-", -1, 0.7);
curve->add("LOWEST D", -1, 0.6);
return curve;
}
// =========================
// ACCESSORS
int num() const {
assert (names.size() == target_distributions.size() && names.size() == fixed_percentages.size());
return names.size();
}
const std::string& getName(int i) const {
assert (i >= 0 && i < num());
return names[i];
}
float getTargetDistribution(int i) const {
assert (i >= 0 && i < num());
return target_distributions[i];
}
float getFixedPercentage(int i) const {
assert (i >= 0 && i < num());
return fixed_percentages[i];
}
// =========================
// MODIFIER
void add(const std::string &name, float distribution, float percentage) {
names.push_back(name);
target_distributions.push_back(distribution);
fixed_percentages.push_back(percentage);
}
private:
// =========================
// REPRESENTATION
// e.g. "perfect", "average", "lowest a-", etc.
std::vector<std::string> names;
// e.g., 30% A/A-, 30% B+/B/B-, 30% C+/C/C-, 10% D/F
std::vector<float> target_distributions;
// e.g., 90% / 80% / 70% / 60%
std::vector<float> fixed_percentages;
};