-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.py
38 lines (31 loc) · 1.02 KB
/
event.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
# -*- coding: utf-8 -*-
"""
Event class:
An event occurs whenever the state of the system (e.g. the queue length)
changes. The Event class creates a new event for the Future Event Set.
Note that the Event class contains a function __lt__. This is a standard
Python function used to compare objects to another (’lt’ stands for “less
than”), to determine the order in which they should be sorted.
"""
class Event:
'''
The Event class is used to create new events for the simulation
'''
ARRIVAL = 0 # constant for arrival type
DEPARTURE = 1 # constant for departure type
def __init__(self, type_: int, time: float) -> None:
'''
Parameters
----------
type_ : int
Type of arrival (arrival or departure)
time : float
The time the event is taking place
Returns
-------
None
'''
self.type = type_
self.time = time
def __lt__(self, other):
return self.time < other.time