Created
September 14, 2010 23:31
-
-
Save tylerkahn/579960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IntervalTree import IntervalTree | |
class ScheduleItem: | |
def __init__(self, course_number, start_time, end_time): | |
self.course_number = course_number | |
self.start_time = start_time | |
self.end_time = end_time | |
def get_begin(self): | |
return minutes_from_midnight(self.start_time) | |
def get_end(self): | |
return minutes_from_midnight(self.end_time) | |
def __repr__(self): | |
return ''.join(["{ScheduleItem: ", str((self.course_number, self.start_time, self.end_time)), "}"]) | |
T = IntervalTree([ScheduleItem(28374, "9:00AM", "10:00AM"), \ | |
ScheduleItem(43564, "8:00AM", "12:00PM"), \ | |
ScheduleItem(53453, "1:00PM", "2:00PM")]) | |
T.search(minutes_from_midnight("11:00AM"), minutes_from_midnight("1:30PM")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment