This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBusData.java
156 lines (137 loc) · 3.9 KB
/
BusData.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
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
package utility;
import utility.delay.DelayFormatException;
import utility.delay.DelayParsingUtility;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
* Scope: global
* Class representing tuple information needed for queries evaluation
*/
@SuppressWarnings("unused")
public class BusData implements Serializable {
// time of the event as Date
private Date eventTime;
// dealy minutes
private Double delay;
// neighbourhood identifier
private String boro;
// delay reason
private String reason;
// bus company name
private String companyName;
/**
* Scope: Kafka Streams' serdes
* Default constructor
*/
public BusData() {
}
/**
* Scope: Kafka Streams' serdes
* @param eventTime time of the event as Date
* @param delay in minutes
* @param boro neighbourhood identifier
* @param reason of delay
* @param companyName bus company name
*/
public BusData(Date eventTime, Double delay, String boro, String reason, String companyName) {
this.eventTime = eventTime;
this.delay = delay;
this.boro = boro;
this.reason = reason;
this.companyName = companyName;
}
/**
* Scope: Global - Query 1
* Constructor with information needed for the first query evaluation
* @param eventTime time of the event as Date
* @param delay in minutes
* @param boro of delay
* @throws ParseException if there was an error parsing the date
* @throws DelayFormatException if no information was found in the delay string
*/
public BusData(String eventTime, String delay, String boro) throws ParseException, DelayFormatException {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
this.eventTime = format.parse(eventTime);
this.delay = DelayParsingUtility.parseDelay(delay);
this.boro = boro;
}
/**
* Scope: Global - Query 2
* Constructor with information needed for the second query evaluation
* @param eventTime time of the event as Date
* @param reason of delay
* @throws ParseException if there was an error parsing the date
*/
public BusData(String eventTime, String reason) throws ParseException {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
this.eventTime = format.parse(eventTime);
this.reason = reason;
}
/**
* Scope: Global - Query 3
* Constructor with information needed for the third query evaluation
* @param eventTime time of the event as Date
* @param delay in minutes
* @param reason of delay
* @param companyName bus company name
* @throws ParseException if there was an error parsing the date
* @throws DelayFormatException if no information was found in the delay string
*/
public BusData(String eventTime, String delay, String reason, String companyName) throws ParseException,
DelayFormatException {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
this.eventTime = format.parse(eventTime);
this.delay = DelayParsingUtility.parseDelay(delay);
this.reason = reason;
this.companyName = companyName;
}
public Date getEventTime() {
return eventTime;
}
public Double getDelay() {
return delay;
}
public String getBoro() {
return boro;
}
public String getReason() {
return reason;
}
public String getCompanyName() {
return companyName;
}
/**
* Scope: Kafka Streams' serdes
*/
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
/**
* Scope: Kafka Streams' serdes
*/
public void setDelay(Double delay) {
this.delay = delay;
}
/**
* Scope: Kafka Streams' serdes
*/
public void setBoro(String boro) {
this.boro = boro;
}
/**
* Scope: Kafka Streams' serdes
*/
public void setReason(String reason) {
this.reason = reason;
}
/**
* Scope: Kafka Streams' serdes
*/
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
}