-
Notifications
You must be signed in to change notification settings - Fork 107
/
car_factory.py
43 lines (37 loc) · 1.75 KB
/
car_factory.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
from battery.nubbin_battery import NubbinBattery
from battery.spindler_battery import SpindlerBattery
from car import Car
from engine.capulet_engine import CapuletEngine
from engine.sternman_engine import SternmanEngine
from engine.willoughby_engine import WilloughbyEngine
class CarFactory:
@staticmethod
def create_calliope(current_date, last_service_date, current_mileage, last_service_mileage):
engine = CapuletEngine(current_mileage, last_service_mileage)
battery = SpindlerBattery(current_date, last_service_date)
car = Car(engine, battery)
return car
@staticmethod
def create_glissade(current_date, last_service_date, current_mileage, last_service_mileage):
engine = WilloughbyEngine(current_mileage, last_service_mileage)
battery = SpindlerBattery(current_date, last_service_date)
car = Car(engine, battery)
return car
@staticmethod
def create_palindrome(current_date, last_service_date, warning_light_is_on):
engine = SternmanEngine(warning_light_is_on)
battery = SpindlerBattery(current_date, last_service_date)
car = Car(engine, battery)
return car
@staticmethod
def create_rorschach(current_date, last_service_date, current_mileage, last_service_mileage):
engine = WilloughbyEngine(current_mileage, last_service_mileage)
battery = NubbinBattery(current_date, last_service_date)
car = Car(engine, battery)
return car
@staticmethod
def create_thovex(current_date, last_service_date, current_mileage, last_service_mileage):
engine = CapuletEngine(current_mileage, last_service_mileage)
battery = NubbinBattery(current_date, last_service_date)
car = Car(engine, battery)
return car