-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCovidData.java
More file actions
226 lines (194 loc) · 5.86 KB
/
CovidData.java
File metadata and controls
226 lines (194 loc) · 5.86 KB
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
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* Represents one record in the COVID dataset.
* This is essentially one row in the data table. Each column
* has a corresponding field.
*/
public class CovidData {
/*
The date the COVID information (cases & deaths) was collected
*/
private String date;
/*
The COVID information is organised by (London) borough
*/
private String borough;
/*
The COVID information that's collected daily for each London borough
*/
private int newCases;
private int totalCases;
private int newDeaths;
private int totalDeaths;
/*
Google analysed location data from Android smartphones to measure movement
in London. The data shows percent change from the baseline. For example,
a negative value means there's less human traffic compared to the baseline.
*/
private int retailRecreationGMR;
private int groceryPharmacyGMR;
private int parksGMR;
private int transitGMR;
private int workplacesGMR;
private int residentialGMR;
/**
* This is the constructor for the CovidData class.
*
* @param date The date of the record.
* @param borough The borough of the record.
* @param retailRecreationGMR The retail and recreation mobility report.
* @param groceryPharmacyGMR The grocery and pharmacy mobility report.
* @param parksGMR The parks mobility report.
* @param transitGMR The transit mobility report.
* @param workplacesGMR The workplaces mobility report.
* @param residentialGMR The residential mobility report.
* @param newCases The new cases.
* @param totalCases The total cases.
* @param newDeaths The new deaths.
* @param totalDeaths The total deaths.
*/
public CovidData(String date, String borough, int retailRecreationGMR, int groceryPharmacyGMR,
int parksGMR, int transitGMR, int workplacesGMR, int residentialGMR,
int newCases, int totalCases,int newDeaths,int totalDeaths) {
this.date = date;
this.borough = borough;
this.retailRecreationGMR = retailRecreationGMR;
this.groceryPharmacyGMR = groceryPharmacyGMR;
this.parksGMR = parksGMR;
this.transitGMR = transitGMR;
this.workplacesGMR = workplacesGMR;
this.residentialGMR = residentialGMR;
this.newCases = newCases;
this.totalCases = totalCases;
this.newDeaths = newDeaths;
this.totalDeaths = totalDeaths;
}
/**
* This function returns the date string.
*
* @return The date string.
*/
public String getDateString() {
return date;
}
/**
* It takes a string in the format of "yyyy-MM-dd" and returns a LocalDate object
*
* @return A LocalDate object
*/
public LocalDate getDate() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return LocalDate.parse(date, dtf);
}
/**
* This function returns the borough.
*
* @return The borough.
*/
public String getBorough() {
return borough;
}
/**
* This function returns the retail and recreation mobility report
*
* @return The retailRecreationGMR is being returned.
*/
public int getRetailRecreationGMR() {
return retailRecreationGMR;
}
/**
* This function returns the value of the variable groceryPharmacyGMR
*
* @return The value of the variable groceryPharmacyGMR.
*/
public int getGroceryPharmacyGMR() {
return groceryPharmacyGMR;
}
/**
* This function returns the google mobility report for parks.
*
* @return The value of the parksGMR variable.
*/
public int getParksGMR() {
return parksGMR;
}
/**
* This function returns the transit GMR of the borough.
*
* @return The transitGMR is being returned.
*/
public int getTransitGMR() {
return transitGMR;
}
/**
* This function returns the google mobility report for workplaces.
*
* @return The value of the variable workplacesGMR.
*/
public int getWorkplacesGMR() {
return workplacesGMR;
}
/**
* This function returns the google mobility report for residential areas.
*
* @return The value of the variable residentialGMR.
*/
public int getResidentialGMR() {
return residentialGMR;
}
/**
* This function returns the new cases.
*
* @return The new cases.
*/
public int getNewCases() {
return newCases;
}
/**
* This function returns the total cases.
*
* @return The total cases.
*/
public int getTotalCases() {
return totalCases;
}
/**
* This function returns the new deaths.
*
* @return The new deaths.
*/
public int getNewDeaths() {
return newDeaths;
}
/**
* This function returns the total deaths.
*
* @return The total deaths.
*/
public int getTotalDeaths() {
return totalDeaths;
}
/**
* This function returns the string representation of the CovidData object.
*
* @return The string representation of the CovidData object.
*/
@Override
public String toString() {
return "Covid Record {" +
" date='" + date +'\'' +
", borough='" + borough +'\'' +
", retailRecreationGMR=" + retailRecreationGMR +
", groceryPharmacyGMR=" + groceryPharmacyGMR +
", parksGMR=" + parksGMR +
", transitGMR=" + transitGMR +
", workplacesGMR=" + workplacesGMR +
", residentialGMR=" + residentialGMR +
", newCases=" + newCases +
", totalCases=" + totalCases +
", newDeaths=" + newDeaths +
", totalDeaths=" + totalDeaths +
"}";
}
}