PageRenderTime 17ms CodeModel.GetById 8ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/dynamictable/Schedule.py

http://pyjamas.googlecode.com/
Python | 22 lines | 18 code | 4 blank | 0 comment | 6 complexity | e973e66e494559e1a4adc777fabdb5eb MD5 | raw file
 1from TimeSlot import TimeSlot
 2
 3class Schedule:
 4
 5    def __init__(self):
 6        self.timeSlots = []
 7
 8    def addTimeSlot(self, timeSlot):
 9        self.timeSlots.append(timeSlot)
10        
11    def getDescription(self, daysFilter):
12        s = None
13        for timeSlot in self.timeSlots:
14            if daysFilter[timeSlot.dayOfWeek]:
15                if not s:
16                    s = timeSlot.getDescription()
17                else:
18                    s += ", " + timeSlot.getDescription()
19        if s:
20            return s
21        else:
22            return ""