5 def query(self, id, unitStart, unitStop, timeStart, timeStop):
8 def insert_record(self, item):
11 class GacksListCalendar(GacksCalendar):
21 def test_lesser(x, y):
29 def test_greater_equal(x, y):
39 def query(self, id, unitStart=0, unitStop=INFINITY, timeStart=0, timeStop=INFINITY):
41 for item in self.items:
42 if test_id(id, item.id) and
43 test_lesser(unitStart, item.unitStop) and
44 test_greater_equal(unitStop, item.unitStart) and
45 test_lesser(timeStart, item.timeStop) and
46 test_greater_equal(timeStop, item.timeStart):
50 def insert_record(self, item):
51 conflicts = self.query(item.id, item.unitStart, item.unitStop, item.timeStart, item.timeStop)
52 for conflict in conflicts:
53 self.items.remove(conflict)
55 self.items.append(item)