-
Notifications
You must be signed in to change notification settings - Fork 28
/
flight.py
54 lines (42 loc) · 1.79 KB
/
flight.py
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
"""`Flight` is extended by `ArrivalFlight` and `DepartureFlight` to cover all
possible flight that is planned before the simulation started.
"""
from aircraft import Aircraft, State
class Flight:
"""`Flight` is the parent class for the `ArrivalFlight` and
`DepartureFlight`.
"""
def __init__(self, aircraft):
self.aircraft = aircraft
class ArrivalFlight(Flight):
"""`ArrivalFlight` represents an arrival flight where its expected arrival
time, runway, spot position, and gate are assigned.
"""
def __init__(self, callsign, model, from_airport, to_gate,
spot, runway, arrival_time, appear_time):
super().__init__(Aircraft(callsign, model, None, State.flying))
self.from_airport = from_airport
self.to_gate = to_gate
self.spot = spot
self.runway = runway
self.arrival_time = arrival_time
self.appear_time = appear_time
def __repr__(self):
return "<Arrival:%s time:%s appear:%s>" \
% (self.aircraft.callsign, self.arrival_time, self.appear_time)
class DepartureFlight(Flight):
"""`DepartureFlight` represents a depature flight where its expected
departure time, gate, spot position, and runway are assigned.
"""
def __init__(self, callsign, model, to_airport, from_gate,
spot, runway, departure_time, appear_time):
super().__init__(Aircraft(callsign, model, None, State.stop))
self.to_airport = to_airport
self.from_gate = from_gate
self.spot = spot
self.runway = runway
self.departure_time = departure_time
self.appear_time = appear_time
def __repr__(self):
return "<Departure:%s time:%s appear:%s>" % \
(self.aircraft.callsign, self.departure_time, self.appear_time)