-
Notifications
You must be signed in to change notification settings - Fork 26
/
clJob.py
32 lines (26 loc) · 1.32 KB
/
clJob.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
#=========================================================================================
class Job():
"""Represent job to-do in schedule"""
def __init__(self, aItineraryName, aItineraryColor, aTaskNumber, aItineraryNumber, aMachineName, aMachineID, aDuration):
self.itinerary = aItineraryName
self.machine = aMachineName
self.machineID = aMachineID
self.startTime = 0
self.duration = aDuration
self.endTime = 0
self.colorOfItinerary = aItineraryColor
self.idOperation = aTaskNumber
self.idItinerary = aItineraryNumber
self.completed = False
self.priority = 0
def __eq__(self, other):
return self.itinerary == other.itinerary and self.colorOfItinerary == other.colorOfItinerary and self.machine == other.machine and self.duration == other.duration and self.completed == other.completed and self.idOperation == other.idOperation
def __hash__(self):
return hash(str(self))
def __str__(self):
return "Job" + str(self.idItinerary) + "_" + str(self.idOperation) + " Machine:" + self.machine + "Duration: " + str(self.duration)
def getTupleStartAndDuration(self):
return (self.startTime, self.duration)
def getEndTime(self):
self.endTime = self.startTime + self.duration
return self.endTime