-
Notifications
You must be signed in to change notification settings - Fork 2
/
ScoreCount.java
102 lines (87 loc) · 2.8 KB
/
ScoreCount.java
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
public class ScoreCount implements java.io.Serializable{
private final double score;
private final double count;
private final double drawCount;
private final double whiteWinCount;
private final double blackWinCount;
private final double sumWhiteElo;
private final double sumBlackElo;
public ScoreCount(double score, double count, double sumWhiteElo, double sumBlackElo) {
if(score == 1) {
whiteWinCount = 1;
drawCount = 0;
blackWinCount = 0;
}
else if(score == 0.5) {
whiteWinCount = 0;
drawCount = 1;
blackWinCount = 0;
}
else {
whiteWinCount = 0;
drawCount = 0;
blackWinCount = 1;
}
this.score = score;
this.count = count;
this.sumBlackElo = sumBlackElo;
this.sumWhiteElo = sumWhiteElo;
}
public ScoreCount(double score, double count, double drawCount, double whiteWinCount, double blackWinCount, double sumWhiteElo, double sumBlackElo) {
this.score = score;
this.count = count;
this.drawCount = drawCount;
this.whiteWinCount = whiteWinCount;
this.blackWinCount = blackWinCount;
this.sumBlackElo = sumBlackElo;
this.sumWhiteElo = sumWhiteElo;
}
public double getDrawCount() {
return drawCount;
}
public double getWhiteWinCount() {
return whiteWinCount;
}
public double getBlackWinCount() {
return blackWinCount;
}
public double getAverageScore() {
return score/count;
}
public double getScore() {
return score;
}
public double getCount() {
return count;
}
public ScoreCount add(ScoreCount a){
return new ScoreCount(a.score + score,
count + a.count,
drawCount + a.drawCount,
whiteWinCount + a.whiteWinCount,
blackWinCount + a.blackWinCount,
sumWhiteElo + a.sumWhiteElo,
sumBlackElo +a.sumBlackElo);
}
public double getAverageWhiteElo() {
return sumWhiteElo/count;
}
public double getAverageBlackElo() {
return sumBlackElo/count;
}
@Override
public String toString() {
return getAverageScore() + "|" + score
+ "|" + count
+ "|" + drawCount
+ "|" + whiteWinCount
+ "|" + blackWinCount
+ "|" + getAverageWhiteElo()
+ "|" + getAverageBlackElo()
+ "|" + sumWhiteElo
+ "|" + sumBlackElo;
}
public static String getFileHeader() {
return "averageScore|score|count|drawCount|whiteWinCount|blackWinCount|averageWhiteElo|averageBlackElo|sumWhiteElo|sumBlackElo";
}
}