-
Notifications
You must be signed in to change notification settings - Fork 0
/
Trip.java
175 lines (155 loc) · 4.01 KB
/
Trip.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package hw4;
import java.time.LocalDateTime;
/**
* This class represents the trip object.
* @author Yihan
*/
public class Trip {
private int id; // Trip ID.
private int duration; // Duration of the trip.
private LocalDateTime startTime; // Trip start time.
private LocalDateTime endTime; // Trip end time.
private int startStation; // Start station ID.
private int endStation; // End station ID.
private double startLat; // Trip start location latitude.
private double startLon; // Trip start location longitude.
private double endLat; // Trip end location latitude.
private double endLon; // Trip end location longitude.
private int bikeID; //Bike ID.
private int planDuration; // Trip plan duration.
private String routeCategory; // Trip route category.
private String passholderType; // Passholder's type.
/**
* Constructor of a Trip object.
* @param id, trip ID.
* @param duration, trip duration.
* @param startTime, trip start time.
* @param endTime, trip end time.
* @param startStation, trip start station ID.
* @param endStation, trip end station ID.
* @param startLat, trip start station latitude.
* @param startLon, trip start station longitude.
* @param endLat, trip end station latitude.
* @param endLon, trip end station longitude.
* @param bikeID, bike ID.
* @param planDuration, trip plan duration.
* @param routeCategory, trip route category.
* @param passholderType, passholder's type.
*/
public Trip(int id, int duration, LocalDateTime startTime, LocalDateTime endTime, int startStation, int endStation,
double startLat, double startLon, double endLat, double endLon, int bikeID, int planDuration,
String routeCategory, String passholderType) {
this.id = id;
this.duration = duration;
this.startTime = startTime;
this.endTime = endTime;
this.startStation = startStation;
this.endStation = endStation;
this.startLat = startLat;
this.startLon = startLon;
this.endLat = endLat;
this.endLon = endLon;
this.bikeID = bikeID;
this.planDuration = planDuration;
this.routeCategory = routeCategory;
this.passholderType = passholderType;
}
/**
* Getter of trip ID.
* @return trip ID.
*/
public int getId() {
return id;
}
/**
* This method returns trip duration.
* @return trip duration.
*/
public int getDuration() {
return duration;
}
/**
* This method returns trip start time.
* @return trip start time.
*/
public LocalDateTime getStartTime() {
return startTime;
}
/**
* This method returns trip end time.
* @return trip end time.
*/
public LocalDateTime getEndTime() {
return endTime;
}
/**
* This method returns trip start station ID.
* @return trip start station ID.
*/
public int getStartStation() {
return startStation;
}
/**
* This method returns trip end station ID.
* @return trip end station ID.
*/
public int getEndStation() {
return endStation;
}
/**
* This method returns trip start latitude.
* @return trip start latitude.
*/
public double getStartLat() {
return startLat;
}
/**
* This method returns trip start longitude.
* @return trip start longitude.
*/
public double getStartLon() {
return startLon;
}
/**
* This method returns trip end latitude.
* @return trip end latitude.
*/
public double getEndLat() {
return endLat;
}
/**
* This method returns trip end longitude.
* @return trip end longitude.
*/
public double getEndLon() {
return endLon;
}
/**
* This method returns the bike ID.
* @return the bike ID.
*/
public int getBikeID() {
return bikeID;
}
/**
* This method returns the trip plan duration.
* @return the trip plan duration.
*/
public int getPlanDuration() {
return planDuration;
}
/**
* This method returns the trip route category.
* @return the trip route category.
*/
public String getRouteCategory() {
return routeCategory;
}
/**
* This method returns the passholder's type.
* @return the passholder's type.
*/
public String getPassholderType() {
return passholderType;
}
}