/pyjs/tests/test015.py

http://pyjamas.googlecode.com/ · Python · 18 lines · 16 code · 2 blank · 0 comment · 5 complexity · 9fcc94348109983c688f7d6b85af0c23 MD5 · raw file

  1. class TimeSlot:
  2. def __init__(self, dayOfWeek, startMinutes, endMinutes):
  3. self.dayOfWeek = dayOfWeek
  4. self.startMinutes = startMinutes
  5. self.endMinutes = endMinutes
  6. def compareTo(self, other):
  7. if self.dayOfWeek < other.dayOfWeek:
  8. return -1
  9. elif self.dayOfWeek > other.dayOfWeek:
  10. return 1
  11. else:
  12. if self.startMinutes < other.startMinutes:
  13. return -1
  14. elif self.startMinutes > other.startMinutes:
  15. return 1
  16. return 0