|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
scheduler.db.instructordb.InstructorDB
public class InstructorDB
This class will be the model interface to the MySQL database containing instructor information. This class allows its users to add, modify, and remove instructors from it. One may also retrieve a collection of instructors in the database.
Nested Class Summary | |
---|---|
static class |
InstructorDB.DuplicateInstructorException
Exception class for adding when instructor already exists. |
static class |
InstructorDB.InstructorDoesNotExistException
This exception is raised when a queried instructor does not exist. |
static class |
InstructorDB.InvalidInstructorException
Exception class for invalid instructor input. |
class |
InstructorDB.PreferenceTuple<E>
Class to house course preference and id. |
class |
InstructorDB.TimePreferenceTuple
Class to house time preference and id. |
Field Summary | |
---|---|
protected java.util.Collection<Instructor> |
data
A collection of Instructors |
java.util.ArrayList<InstructorDB.PreferenceTuple> |
preferences
A collection of Instructors with course preferences |
java.util.ArrayList<InstructorDB.TimePreferenceTuple> |
timepreferences
A collection of Instructors with time preferences |
Constructor Summary | |
---|---|
InstructorDB()
Here's a constructor that, in fact, does nothing. |
|
InstructorDB(java.util.Collection<Instructor> data)
This constructor builds an instructordb with predefined data. |
Method Summary | |
---|---|
void |
addInstructor(Instructor i)
Adds a given instructor to the instructor database. |
void |
changePreferences(java.util.Vector<java.util.Vector> dataTable,
Instructor i)
This method changes the course preferences of a particular instructor. |
void |
changeTimePreferences(java.util.Vector<java.util.Vector> dataTable,
Instructor i)
This method changes the time preferences of a particular instructor. |
Instructor |
checkNext()
Get next and iterator stays the same |
void |
editInstructor(Instructor i)
Edits a given instructor which is already in the database. |
void |
findAndChange(InstructorDB.PreferenceTuple pt)
Edits an instructor's preference of a certain id and course. |
void |
findAndChangeTime(InstructorDB.TimePreferenceTuple pt)
Edits and instructor's preference of a certain id and time. |
java.util.Collection<Instructor> |
getData()
Returns the collection of instructors. |
java.util.Collection<Instructor> |
getDataByGenerosity()
Returns the instructors sorted by generousity |
Instructor |
getInstructor(java.lang.String id)
Returns the instructor from the database matching the inputted string. |
Instructor |
getInstructorByName(java.lang.String name)
Returns the instructor from the database matching the name given. |
Instructor |
getNext()
Get next and increase iterator |
CoursePreference |
getPreference(Instructor i,
Course c)
Gets the preference of a particular course for a particular instructor. |
java.util.ArrayList<CoursePreference> |
getPreferences(Instructor i)
This method will return all course preferences for a given instructor. |
java.util.Vector<java.util.Vector> |
getTable()
Returns a table of instructors and courses in the database. |
java.util.ArrayList<TimePreference> |
getTimePreferences(Instructor i)
Returns the time preferences list for this instructor. |
boolean |
isValidInstructor(Instructor instructor)
Checks if the Instructor is in the database. |
protected boolean |
isValidInstructorDB(InstructorDB db)
Checks if the Instructor Database is valid. |
void |
removeInstructor(Instructor i)
Removes a given instructor from the database. |
void |
reset()
Reset iterator |
void |
setData(java.util.Collection<Instructor> data)
Sets the data in the instructorDB. |
void |
SetPreferredCourses(Instructor instructor,
java.util.Vector<Course> course)
Adds a vector of preferred courses to the instructor. |
void |
updatePreferences()
This function updates the course preferences for this instructor. |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Collection<Instructor> data
public java.util.ArrayList<InstructorDB.PreferenceTuple> preferences
public java.util.ArrayList<InstructorDB.TimePreferenceTuple> timepreferences
Constructor Detail |
---|
public InstructorDB()
public InstructorDB(java.util.Collection<Instructor> data)
data
- predefined list of instructors.Method Detail |
---|
public void addInstructor(Instructor i) throws InstructorDB.InvalidInstructorException, InstructorDB.DuplicateInstructorException, Instructor.NullUserIDException
i
- the new instructor to add to the database
InstructorDB.InvalidInstructorException
InstructorDB.DuplicateInstructorException
Instructor.NullUserIDException
public void changePreferences(java.util.Vector<java.util.Vector> dataTable, Instructor i)
dataTable
- table of course preferences.i
- instructor whose course preference you wish to change.public void changeTimePreferences(java.util.Vector<java.util.Vector> dataTable, Instructor i)
dataTable
- table of time preferences.i
- instructor whose time preference you wish to change.public Instructor checkNext()
public void editInstructor(Instructor i)
instructor
- the instructor to editpublic void findAndChange(InstructorDB.PreferenceTuple pt)
pt
- the preference tuple to change.public void findAndChangeTime(InstructorDB.TimePreferenceTuple pt)
pt
- time preference tuple to change.public java.util.Collection<Instructor> getData()
public java.util.Collection<Instructor> getDataByGenerosity()
public Instructor getInstructor(java.lang.String id)
id
- user id of the instructor to get.
public Instructor getInstructorByName(java.lang.String name)
name
- Name of instructor, given in [last],[first] format.
public Instructor getNext()
public CoursePreference getPreference(Instructor i, Course c)
i
- instructor whose preference to get.c
- course to use to get the preference for this instructor.
public java.util.ArrayList<CoursePreference> getPreferences(Instructor i)
i
- the instructor for whom to get course preferences.
public java.util.Vector<java.util.Vector> getTable()
public java.util.ArrayList<TimePreference> getTimePreferences(Instructor i)
i
- the instructor for whom to get time preferences.
public boolean isValidInstructor(Instructor instructor)
instructor
- instructor to check for in the databasedb
- the database in which to check for the instructor
pre:
// none
post;
// none
protected boolean isValidInstructorDB(InstructorDB db)
db
- the database to check validity for
public void removeInstructor(Instructor i)
instructor
- the instructor to remove from the databasepublic void reset()
public void setData(java.util.Collection<Instructor> data)
data
- The data to be set.public void SetPreferredCourses(Instructor instructor, java.util.Vector<Course> course)
instructor
- the instructor for whom to set preferred coursescourse
- a vector of courses representing the preferencepublic void updatePreferences()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |