/examples/dynamictable/Schedule.py
Python | 22 lines | 18 code | 4 blank | 0 comment | 6 complexity | e973e66e494559e1a4adc777fabdb5eb MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
- from TimeSlot import TimeSlot
- class Schedule:
- def __init__(self):
- self.timeSlots = []
- def addTimeSlot(self, timeSlot):
- self.timeSlots.append(timeSlot)
-
- def getDescription(self, daysFilter):
- s = None
- for timeSlot in self.timeSlots:
- if daysFilter[timeSlot.dayOfWeek]:
- if not s:
- s = timeSlot.getDescription()
- else:
- s += ", " + timeSlot.getDescription()
- if s:
- return s
- else:
- return ""