class WorkPiece object def __init__ self start end train self start st

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class WorkPiece(object):
def __init__(self, start, end, train):
self.start = start
self.end = end
self.train = train
self.shifts = []
self.covered = False
def add_shift(self, shift):
self.shifts.append(shift)
def __cmp__(self, other):
return cmp(len(self.shifts), len(other.shifts))
def __repr__(self):
r = 'WorkPiece(%d-%d, train %s)' % (self.start, self.end, self.train)
return r