-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlight.java
184 lines (152 loc) · 4.93 KB
/
Flight.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
176
177
178
179
180
181
182
183
184
import java.util.ArrayList;
import java.util.Date;
import java.util.UUID;
public class Flight {
private UUID flightID;
private Airline airline;
private String departureLocation;
private String destinationLocation;
private boolean isConnecting;
private Flight previousFlight;
private Flight nextFlight;
private Date departureTime;
private Date arrivalTime;
private double flightDuration;
private int numRows;
private int numSeatsPerRow;
private ArrayList<ArrayList<Seat>> seats;
/**
* Constructor for flights
* @param flightID
* @param airline
* @param departureLocation
* @param destinationLocation
* @param isConnecting
* @param previousFlight
* @param nextFlight
* @param departureTime
* @param arrivalTime
* @param flightDuration
* @param numRows
* @param numSeatsPerRow
* @param seats
*/
public Flight(UUID flightID, Airline airline, String departureLocation, String destinationLocation,
boolean isConnecting, Flight previousFlight, Flight nextFlight, Date departureTime,
Date arrivalTime, double flightDuration, int numRows, int numSeatsPerRow, ArrayList<ArrayList<Seat>> seats) {
this.flightID = flightID;
this.airline = airline;
this.departureLocation = departureLocation;
this.destinationLocation = destinationLocation;
this.isConnecting = isConnecting;
this.previousFlight = previousFlight;
this.nextFlight = nextFlight;
this.departureTime = departureTime;
this.arrivalTime = arrivalTime;
this.flightDuration = flightDuration;
this.numRows = numRows;
this.numSeatsPerRow = numSeatsPerRow;
this.seats = seats;
if (this.isConnecting && this.previousFlight != null) {
this.flightDuration += this.previousFlight.getFlightDuration();
}
}
/**
* Getters and setters
* @return
*/
public UUID getFlightID()
{
return flightID;
}
public void setFlightID(UUID flightID)
{
this.flightID = flightID;
}
public Flight(){
} // ending bracket of default constructor
public Airline getAirline()
{
return airline;
}
public void setAirline(Airline airline)
{
this.airline = airline;
}
public String getDepartureLocation() {
return departureLocation;
}
public void setDepartureLocation(String departureLocation) {
this.departureLocation = departureLocation;
}
public String getDestinationLocation() {
return destinationLocation;
}
public void setDestinationLocation(String destinationLocation) {
this.destinationLocation = destinationLocation;
}
public boolean getIsConnecting() {
return isConnecting;
}
public void setIsConnecting(boolean isConnecting) {
this.isConnecting = isConnecting;
}
public Flight getPreviousFlight() {
return previousFlight;
}
public void setPreviousFlight(Flight previousFlight) {
this.previousFlight = previousFlight;
}
public Flight getNextFlight() {
return nextFlight;
}
public void setNextFlight(Flight nextFlight) {
this.nextFlight = nextFlight;
}
public Date getDepartureTime() {
return departureTime;
}
public void setDepartureTime(Date departureTime) {
this.departureTime = departureTime;
}
public Date getArrivalTime() {
return arrivalTime;
}
public void setArrivalTimer(Date arrivalTime) {
this.arrivalTime = arrivalTime;
}
public double getFlightDuration()
{
return flightDuration;
}
public void setFlightDuration(double flightDuration)
{
this.flightDuration = flightDuration;
}
public int getNumRows() {
return numRows;
}
public void setNumRows(int numRows) {
this.numRows = numRows;
}
public int getNumSeatsPerRow() {
return numSeatsPerRow;
}
public void setNumSeatsPerRow(int numSeatsPerRow) {
this.numSeatsPerRow = numSeatsPerRow;
}
public ArrayList<ArrayList<Seat>> getSeats() {
return seats;
}
public void setSeats(ArrayList<ArrayList<Seat>> seats) {
this.seats = seats;
}
/**
* returns a string of the flight details
*/
public String toString() {
String ret = "Flight " + airline.getName() + " departing from " + departureLocation + " at " + departureTime + " arriving at "
+ destinationLocation + " at " + arrivalTime + ". Flight duration " + flightDuration + " hours.";
return ret;
}
}