-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataPoint.pde
More file actions
103 lines (97 loc) · 3.01 KB
/
Copy pathDataPoint.pde
File metadata and controls
103 lines (97 loc) · 3.01 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
//C.McCooey - Declared attributes for DataPoint class - 9am 16/03/23
class DataPoint {
boolean isAirportList;
boolean isStateList;
boolean isAirlineList;
String flightDate;
String marketingCarrier;
int marketingCarrierFlightNum;
String originAirport;
String originCity;
String originStateAbr;
int originWAC;
String destinationAirport;
String destinationCity;
String destinationStateAbr;
int destinationWAC;
int intExpectedDepartureTime;
int intDepartureTime;
int intExpectedArrivalTime;
int intArrivalTime;
int cancelled;
int diverted;
int distance;
int delay;
//C.McCooey - Wrote initial version of DataPoint constructor - 9am 16/03/23
//C.McCooey - Updated constructor to accept SQLite table instead of TableRow - 4pm 28/03/23
DataPoint(boolean isAirportList, boolean isStateList, boolean isAirlineList, SQLite db) {
if (isAirportList) {
originAirport = db.getString("Origin");
} else if (isStateList) {
originStateAbr = db.getString("OriginState");
}else if(isAirlineList){
distance = db.getInt("Distance");
marketingCarrier = db.getString("IATA_Code_Marketing_Airline");
} else {
cancelled = db.getInt("Cancelled");
switch(cancelled) {
case 0:
intDepartureTime = db.getInt("DepTime");
intArrivalTime = db.getInt("ArrTime");
break;
case 1:
default:
intDepartureTime = -1;
intArrivalTime = -1;
break;
}
//Convert these to date format within constructor?
flightDate = db.getString("FlightDate");
if (flightDate != null)flightDate = flightDate.split(" ")[0]; //C. McCooey - Fixed date to not include redundant hours/minutes - 4pm 16/03/23
marketingCarrier = db.getString("IATA_Code_Marketing_Airline");
marketingCarrierFlightNum = db.getInt("Flight_Number_Marketing_Airline");
originAirport = db.getString("Origin");
try {
originCity = db.getString("OriginCityName");
}
catch(Exception e) {
}
originStateAbr = db.getString("OriginState");
//originWAC = db.getInt("OriginWac");
destinationAirport = db.getString("Dest");
try {
destinationCity = db.getString("DestCityName");
}
catch(Exception e) {
}
destinationStateAbr = db.getString("DestState");
//destinationWAC = db.getInt("DestWac");
try {
intExpectedDepartureTime = db.getInt("CRSDepTime");
}
catch(Exception e) {
}
try {
intExpectedArrivalTime = db.getInt("CRSArrTime");
}
catch(Exception e) {
}
//Convert these to date format within constructor?
try {
diverted = db.getInt("Diverted");
}
catch(Exception e) {
}
try {
distance = db.getInt("Distance");
}
catch(Exception e) {
}
try {
delay = db.getInt("ArrDelay");
}
catch(Exception e) {
}
}
}
}