|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.db.instructordb.Instructor
public class 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.
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 |
---|
private java.lang.String firstName
private java.lang.String lastName
private java.lang.String userID
private int wtu
private Location office
private int fairness
private boolean disability
private int generosity
private WeekAvail availability
private java.util.ArrayList<CoursePreference> coursePreferences
private java.util.ArrayList<TimePreference> timePreferences
Constructor Detail |
---|
public Instructor(Instructor i)
i
- The instructor to copypublic Instructor(java.lang.String first, java.lang.String last, java.lang.String id, int wtu, Location office)
first
- the first name of the instructorlast
- the last name of the instructorid
- the user id of the instructorwtu
- the work-time units of the instructoroffice
- the office building and room numbers of the instructorpublic Instructor(java.lang.String first, java.lang.String last, java.lang.String id, int wtu, Location office, boolean disabilities)
first
- the first name of the instructorlast
- the last name of the instructorid
- the user id of the instructorwtu
- the work-time units of the instructoroffice
- the office building and room numbers of the instructordisabilities
- whether or not the professor has any disabilitiesMethod Detail |
---|
public void addCoursePreference(CoursePreference preference) throws Instructor.NullPreferenceException
preference
-
Instructor.NullPreferenceException
public void removeCoursePreference(CoursePreference preference) throws Instructor.NullPreferenceException
preference
-
Instructor.NullPreferenceException
public void addTimePreference(TimePreference preference) throws Instructor.NullPreferenceException
preference
-
Instructor.NullPreferenceException
public int compareTo(Instructor o)
compareTo
in interface java.lang.Comparable<Instructor>
o
- Thing to compare
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the object to compare with
public java.util.ArrayList<CoursePreference> getCoursePreferences()
public void setCoursePreferences(java.util.ArrayList<CoursePreference> cPreferences)
the
- list of course preferences.public boolean getDisability()
public int getFairness()
public java.lang.String getFirstName()
public int getGenerosity()
public java.lang.String getId() throws Instructor.NullUserIDException
Instructor.NullUserIDException
public java.lang.String getLastName()
public int getMaxWTU()
public java.lang.String getName()
public Location getOffice()
public int getPref(Course course)
course
- the course to lookup
public int getPreference(Course course)
course
- the course for which to get the preference.
public int getPreference(Time time)
time
- the time of the preference to get.
public java.util.ArrayList<TimePreference> getTimePreferences()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isAvailable(int dayOfWeek, Time starttime, Time endtime) throws EndBeforeStartException, NotADayException
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.
EndBeforeStartException
NotADayException
public void setBusy(int dayOfWeek, Time starttime, Time endtime)
dayOfWeek
- the day of the week.starttime
- the start time to set busy.endtime
- the end time of the busy interval.public void setFairness(int fairness)
fairness
- the wanted fairness value of this isntructor.public void setGenerosity(int generosity)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |