-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEvent.py
More file actions
46 lines (37 loc) · 941 Bytes
/
Copy pathEvent.py
File metadata and controls
46 lines (37 loc) · 941 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
38
39
40
41
42
43
44
import time
from enum import Enum
from Application import Task
from Location import Location
from typing import Optional
class EventType(Enum):
Offload = 1
Process = 2
Returned = 3
UserMove = 4
UserStop = 5
UAVStop = 6
UAVMove = 7
State = 8
class Event(object):
id: int = 0
events = []
def __init__(self, type: EventType, task, simTime, uav, user, loc: Location):
self.id = Event.id
Event.id += 1
Event.events.append(self)
self.scheduledTime = simTime
self.type = type
self.fromLayer = None
self.toLayer = None
self.task: Task = task
self.uav = uav
self.user = user
self.location = loc
def __lt__(self, other):
if self.scheduledTime < other.scheduledTime:
return True
return False
@classmethod
def resetAll(cls):
Event.id = 0
Event.events = []