scheduler.db.instructordb
Class Instructor

java.lang.Object
  extended by scheduler.db.instructordb.Instructor
All Implemented Interfaces:
java.lang.Comparable<Instructor>

public class Instructor
extends java.lang.Object
implements java.lang.Comparable<Instructor>

This class holds the information necessary to represent an instructor. Through this class the name, office number, work-time units, and other necessary information may be accessed and stored.

Author:
Cedric Wienold

Nested Class Summary
 class Instructor.InvalidDayOfWeekException
          This exception class is thrown when the day of week is not in the Sunday to Saturday format.
static class Instructor.InvalidInstructorException
          Exception class for generally bad instructors.
 class Instructor.InvalidTimeInputException
          This exception is raised when invalid time inputs are entered.
static class Instructor.NullPreferenceException
          Exception class for null preferences.
static class Instructor.NullUserIDException
          Exception class for null user ids.
 
Field Summary
private  WeekAvail availability
          A 7x48 table to contain whether an instructor is available at a time.
private  java.util.ArrayList<CoursePreference> coursePreferences
          List of preferences each instructor has for a course.
private  boolean disability
          Whether or not the instructor has a disability.
private  int fairness
          The fairness with which the instructor has been treated
private  java.lang.String firstName
          First name of instructor.
private  int generosity
          The generosity of the instructors scheduler.
private  java.lang.String lastName
          Last name of instructor.
private  Location office
          Building and office number of instructor.
private  java.util.ArrayList<TimePreference> timePreferences
          List of time preferences an instructor has for a course.
private  java.lang.String userID
          User ID of instructor.
private  int wtu
          Work-Time units.
 
Constructor Summary
Instructor(Instructor i)
          Returns a new, fresh copy of a given instructor.
Instructor(java.lang.String first, java.lang.String last, java.lang.String id, int wtu, Location office)
          Constructs the instructor with the given first and last names, and user id.
Instructor(java.lang.String first, java.lang.String last, java.lang.String id, int wtu, Location office, boolean disabilities)
          Constructs the instructor with the given first and last names, and user id.
 
Method Summary
 void addCoursePreference(CoursePreference preference)
          This method adds a course preference to the instructor.
 void addTimePreference(TimePreference preference)
          This method will add a time preference for this instructor.
 int compareTo(Instructor o)
          Added so I can make an ordered list of Instructors
 boolean equals(java.lang.Object other)
          This method will return true if the argument is not null, is an Instructor class and has the same userID as this object.
 java.util.ArrayList<CoursePreference> getCoursePreferences()
          This method returns the list of course preferences.
 boolean getDisability()
          Returns a boolean representing whether an instructor has a disability.
 int getFairness()
          Returns the fairness value of this instructor.
 java.lang.String getFirstName()
          Returns a string representing this instructor's first name.
 int getGenerosity()
          Returns the generosity of the instructors.
 java.lang.String getId()
          Returns the id of the instructors.
 java.lang.String getLastName()
          Returns a string representing this instructor's last name.
 int getMaxWTU()
          Returns the instructor's work-time units.
 java.lang.String getName()
          Returns a string representing the instructor's name in the form first name - space - last name.
 Location getOffice()
          Returns the instructor's office.
 int getPref(Course course)
          Returns an instructor's preferences for a given course.
 int getPreference(Course course)
          This method will get a course preference from the list of preferences.
 int getPreference(Time time)
          This method will return the time preference from the list of preferences.
 java.util.ArrayList<TimePreference> getTimePreferences()
          This method returns the list of time preferences.
 int hashCode()
          Overridden to allow for hash table implementation
 boolean isAvailable(int dayOfWeek, Time starttime, Time endtime)
          This method will tell whether this instructor is availble during the given time slot.
 void removeCoursePreference(CoursePreference preference)
          This method removes a course preference to the instructor.
 void setBusy(int dayOfWeek, Time starttime, Time endtime)
          This method will take in a day, start time, and end time and set that time interval as busy for this instructor.
 void setCoursePreferences(java.util.ArrayList<CoursePreference> cPreferences)
          This method sets the course preferences for the instructor.
 void setFairness(int fairness)
          Sets the fairness value of this instructor.
 void setGenerosity(int generosity)
          Set the generosity
 java.lang.String toString()
          Returns a lastname-comma-firstname representation of this instructor's name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

firstName

private java.lang.String firstName
First name of instructor.


lastName

private java.lang.String lastName
Last name of instructor.


userID

private java.lang.String userID
User ID of instructor.


wtu

private int wtu
Work-Time units.


office

private Location office
Building and office number of instructor.


fairness

private int fairness
The fairness with which the instructor has been treated


disability

private boolean disability
Whether or not the instructor has a disability.


generosity

private int generosity
The generosity of the instructors scheduler.


availability

private WeekAvail availability
A 7x48 table to contain whether an instructor is available at a time.


coursePreferences

private java.util.ArrayList<CoursePreference> coursePreferences
List of preferences each instructor has for a course.


timePreferences

private java.util.ArrayList<TimePreference> timePreferences
List of time preferences an instructor has for a course.

Constructor Detail

Instructor

public Instructor(Instructor i)
Returns a new, fresh copy of a given instructor. The important thing here is that the instructor's availability is not connected with the one being copied. Written by: Eric Liebowitz

Parameters:
i - The instructor to copy

Instructor

public Instructor(java.lang.String first,
                  java.lang.String last,
                  java.lang.String id,
                  int wtu,
                  Location office)
Constructs the instructor with the given first and last names, and user id.

Parameters:
first - the first name of the instructor
last - the last name of the instructor
id - the user id of the instructor
wtu - the work-time units of the instructor
office - the office building and room numbers of the instructor

Instructor

public Instructor(java.lang.String first,
                  java.lang.String last,
                  java.lang.String id,
                  int wtu,
                  Location office,
                  boolean disabilities)
Constructs the instructor with the given first and last names, and user id.

Parameters:
first - the first name of the instructor
last - the last name of the instructor
id - the user id of the instructor
wtu - the work-time units of the instructor
office - the office building and room numbers of the instructor
disabilities - whether or not the professor has any disabilities
Method Detail

addCoursePreference

public void addCoursePreference(CoursePreference preference)
                         throws Instructor.NullPreferenceException
This method adds a course preference to the instructor.

Parameters:
preference -
Throws:
Instructor.NullPreferenceException

removeCoursePreference

public void removeCoursePreference(CoursePreference preference)
                            throws Instructor.NullPreferenceException
This method removes a course preference to the instructor.

Parameters:
preference -
Throws:
Instructor.NullPreferenceException

addTimePreference

public void addTimePreference(TimePreference preference)
                       throws Instructor.NullPreferenceException
This method will add a time preference for this instructor.

Parameters:
preference -
Throws:
Instructor.NullPreferenceException

compareTo

public int compareTo(Instructor o)
Added so I can make an ordered list of Instructors

Specified by:
compareTo in interface java.lang.Comparable<Instructor>
Parameters:
o - Thing to compare
Returns:
1 if o was greater. 0 if equal. -1 if lesser.

equals

public boolean equals(java.lang.Object other)
This method will return true if the argument is not null, is an Instructor class and has the same userID as this object.

Overrides:
equals in class java.lang.Object
Parameters:
other - the object to compare with
Returns:
whether the two objects are equal

getCoursePreferences

public java.util.ArrayList<CoursePreference> getCoursePreferences()
This method returns the list of course preferences.

Returns:
the list of course preferences.

setCoursePreferences

public void setCoursePreferences(java.util.ArrayList<CoursePreference> cPreferences)
This method sets the course preferences for the instructor.

Parameters:
the - list of course preferences.

getDisability

public boolean getDisability()
Returns a boolean representing whether an instructor has a disability.

Returns:
a boolean representing whether an instructor has a disability

getFairness

public int getFairness()
Returns the fairness value of this instructor.

Returns:
the fairness value of this instructor.

getFirstName

public java.lang.String getFirstName()
Returns a string representing this instructor's first name.

Returns:
the instructor's first name.

getGenerosity

public int getGenerosity()
Returns the generosity of the instructors.


getId

public java.lang.String getId()
                       throws Instructor.NullUserIDException
Returns the id of the instructors.

Throws:
Instructor.NullUserIDException

getLastName

public java.lang.String getLastName()
Returns a string representing this instructor's last name.

Returns:
the instructor's last name.

getMaxWTU

public int getMaxWTU()
Returns the instructor's work-time units.

Returns:
this instructor's work-time units

getName

public java.lang.String getName()
Returns a string representing the instructor's name in the form first name - space - last name.

Returns:
the first - space - last name representation of this instructor's name.

getOffice

public Location getOffice()
Returns the instructor's office.

Returns:
the instructor's office.

getPref

public int getPref(Course course)
Returns an instructor's preferences for a given course.

Parameters:
course - the course to lookup
Returns:
the professor's preference for Course course

getPreference

public int getPreference(Course course)
This method will get a course preference from the list of preferences.

Parameters:
course - the course for which to get the preference.
Returns:
the course preference for the given course.

getPreference

public int getPreference(Time time)
This method will return the time preference from the list of preferences.

Parameters:
time - the time of the preference to get.
Returns:
the time preference related to the given time.

getTimePreferences

public java.util.ArrayList<TimePreference> getTimePreferences()
This method returns the list of time preferences.

Returns:
the list of time preferences.

hashCode

public int hashCode()
Overridden to allow for hash table implementation

Overrides:
hashCode in class java.lang.Object

isAvailable

public boolean isAvailable(int dayOfWeek,
                           Time starttime,
                           Time endtime)
                    throws EndBeforeStartException,
                           NotADayException
This method will tell whether this instructor is availble during the given time slot.

Parameters:
dayOfWeek - the day of the week, from 0 to 6, inclusive.
starttime - the beginning time of the query.
endtime - the end time of the query.
Returns:
whether the location is available during this time.
Throws:
EndBeforeStartException
NotADayException

setBusy

public void setBusy(int dayOfWeek,
                    Time starttime,
                    Time endtime)
This method will take in a day, start time, and end time and set that time interval as busy for this instructor.

Parameters:
dayOfWeek - the day of the week.
starttime - the start time to set busy.
endtime - the end time of the busy interval.

setFairness

public void setFairness(int fairness)
Sets the fairness value of this instructor.

Parameters:
fairness - the wanted fairness value of this isntructor.

setGenerosity

public void setGenerosity(int generosity)
Set the generosity


toString

public java.lang.String toString()
Returns a lastname-comma-firstname representation of this instructor's name.

Overrides:
toString in class java.lang.Object
Returns:
the full string representation of this instructor's name