-
Notifications
You must be signed in to change notification settings - Fork 0
/
Client.py
47 lines (38 loc) · 1.57 KB
/
Client.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
class Client:
"""This class was made to represent a client that
arrives at the queue and is server by the server"""
def __init__(self, arrival_time, service_time, round_num):
"""Sets the arrival time, service time and round number of the client"""
self.__arrival_time = arrival_time
self.__service_time = service_time
self.__round_num = round_num
self.__wait_time = None
self.__departure_time = None
def get_arrival_time(self):
"""Returns the arrival time"""
return self.__arrival_time
def get_service_time(self):
"""Returns the service time"""
return self.__service_time
def get_round(self):
"""Returns the round number of the client"""
return self.__round_num
def get_wait_time(self):
"""Returns the wait time"""
return self.__wait_time
def set_wait_time(self, wait_time):
"""Sets the wait time if possible"""
if self.__wait_time is None:
self.__wait_time = wait_time
def get_departure_time(self):
"""Returns the departure time"""
return self.__departure_time
def set_departure_time(self, departure_time):
"""Sets the departure time if possible"""
if self.__departure_time is None:
self.__departure_time = departure_time
def __str__(self):
return f"Arrival time: {self.__arrival_time}\n" \
f"Service time: {self.__service_time}\n" \
f"Wait time: {self.__wait_time}\n" \
f"Departure time: {self.__departure_time}\n"