parking_spot_strategy
Strategy: To find parking spot.
FindNearestSpotStrategy
¶
Bases: FindParkingSpotStrategy
Derived Class: Implements finding nearest free parking spot.
Source code in parking_lot/src/parking_spot_strategy.py
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 |
|
__init__(entrance_panels, free_spots, parking_spot_counts)
¶
Initalize instance of nearest parking spot strategy.
Source code in parking_lot/src/parking_spot_strategy.py
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 |
|
find_parking_spot(entrance_panel_id, spot_type, free_spots)
¶
Find spot nearest to entrance. Running Time: O(|Num_Entrances|)
Source code in parking_lot/src/parking_spot_strategy.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
update_parking_spot(spot_id, spot_type)
¶
Update list of free spots on each vehicle's exit.
Source code in parking_lot/src/parking_spot_strategy.py
104 105 106 107 108 109 110 111 112 |
|
FindParkingSpotStrategy
¶
Base Class: to find parking spot.
Source code in parking_lot/src/parking_spot_strategy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
find_parking_spot(entrance_panel_id, spot_type, free_spots)
abstractmethod
¶
Find parking spot.
Source code in parking_lot/src/parking_spot_strategy.py
15 16 17 18 19 20 21 22 23 |
|
update_parking_spot_on_exit()
abstractmethod
¶
Update list of free spots on each vehicle's exit.
Source code in parking_lot/src/parking_spot_strategy.py
25 26 27 28 |
|
FindRandomSpotStrategy
¶
Bases: FindParkingSpotStrategy
Derived Class: Implements finding random free parking spot.
Source code in parking_lot/src/parking_spot_strategy.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
find_parking_spot(entrance_panel_id, spot_type, free_spots)
¶
Find the first free parking spot.
Source code in parking_lot/src/parking_spot_strategy.py
34 35 36 37 38 39 40 41 42 |
|
update_parking_spot_on_exit()
¶
Update list of free spots on each vehicle's exit.
Source code in parking_lot/src/parking_spot_strategy.py
44 45 46 |
|