-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimEvent.py
More file actions
38 lines (31 loc) · 969 Bytes
/
Copy pathSimEvent.py
File metadata and controls
38 lines (31 loc) · 969 Bytes
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
"""
SimEvent.py
"""
import sys
import CheckoutLane
CUSTOMER_READY = 0
CUSTOMER_COMPLETE = 1
# event_type: CUSTOMER_READY | CUSTOMER_COMPLETE
class SimEvent:
def __init__(self, time, event_type, lane, customer):
"""
:param time: The time the event occurs
:param event_type: CUSTOMER_READY = 0 | CUSTOMER_COMPLETE = 1
:param lane: The CheckoutLane object
:param customer: the Customer object
"""
self.event_type = event_type
self.lane = lane
self.customer = customer
self.time = time
def handle_event(self):
"""
Perform the action associated with this event.
:return: none
"""
if self.event_type == CUSTOMER_READY:
self.lane.customer_enter(self.customer)
self.customer.log_in()
elif self.event_type == CUSTOMER_COMPLETE:
self.lane.customer_exit()
self.customer.log_out(self.time)