scheduler.generate
Class FindTime

java.lang.Object
  extended by scheduler.generate.FindTime

public class FindTime
extends java.lang.Object

FindTime supports the generation algorithm. This class reviews input and determines of a list of ideal times to schedule a course.

Author:
Leland Garofalo

Field Summary
private static Time endTime
          Temporary holder for start Times
private static Time startTime
          Temporary holder for start Times
private static java.util.LinkedHashMap<Time,Time> timehash
          LinkedHashMap to store return times
private static TimePreferenceComparator timePrefComparator
          Comparator used to sort TimePreferences
private static java.util.ArrayList<TimePreference> timeprefs
          List of TimePreferences
 
Constructor Summary
FindTime()
           
 
Method Summary
static java.util.LinkedHashMap<Time,Time> findIdealTime(Instructor instructor, Course course)
          Finds a suitable time to apply to section
static boolean timeWorks(Instructor instructor, Time startTime, Time endTime)
          Checks if a Time works for enough days
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timePrefComparator

private static TimePreferenceComparator timePrefComparator
Comparator used to sort TimePreferences


timeprefs

private static java.util.ArrayList<TimePreference> timeprefs
List of TimePreferences


timehash

private static java.util.LinkedHashMap<Time,Time> timehash
LinkedHashMap to store return times


startTime

private static Time startTime
Temporary holder for start Times


endTime

private static Time endTime
Temporary holder for start Times

Constructor Detail

FindTime

public FindTime()
Method Detail

findIdealTime

public static java.util.LinkedHashMap<Time,Time> findIdealTime(Instructor instructor,
                                                               Course course)
Finds a suitable time to apply to section

Parameters:
i - The instructor to use in search
c - The course that is being used to search for a time
Returns:
Suitable time to teach specific course
 // ** Pre and Post conditions ** //
 
 Pre:

 // Instructor value can not be null
 i != nil

 &&

 // Course value can not be null
 c != nil

 &&

  //Instructor must be in the instructor database
  db.instructorDB.isValidInstructor(i)

 &&

 // Course must be in the course database
 db.coursedb.isValidCourse(c)

 Post:

 //The returned time must not conflict with instructors teaching times
 db.instructorDB.isValidTime(instructor,time)

 &&
 
 //The returned time must not violate any schedule attributes
 scheduler.isValidTime(time)

 

timeWorks

public static boolean timeWorks(Instructor instructor,
                                Time startTime,
                                Time endTime)
Checks if a Time works for enough days

Parameters:
i - The instructor to use in search
s - The start time
e - The end time
Returns:
True if the time will work and False if it will not.
 // ** Pre and Post conditions ** //
 
 Pre:

 // Instructor value can not be null
 i != nil

 &&

 // startTime can not be null
 s != nil

 &&

 // endTime can not be null
 e != nil

 Post: