package resources.instructor; import java.util.Collection; import java.util.List; /** * This class represents the Database of all Instructors. The administrator is * allowed to add Instructors and get Instructors to make modifications to * their preferences. * * @author sbayley */ public abstract class InstructorDB { public Collection instructors; //collection of Instructors /** * Adds a new Instructor to the DB * * @param i * new instructor to add to InstructorDB */ /* pre: // // There is no Instructor in the input DB with the same Name // as the Instructor to be added. // !exists (Instructor other; instructors.contains(other); i.name.first.equals(other.name.first) && i.name.last.equals(other.name.last)) && // // The instructors name is not null // (i.name.first != null && i.name.last != null) && // // The employeeId is not empty and greater than 0 // (i.employeeId != null && i.employeeId > 0) post: // // An Instructor is in output DB if and only if it is the Instructor // to be added or it is in the input DB. // forall (Instructor other; instructors'.contains(i) iff other.equals(i) || instructors.contains(other)); */ public abstract void add(Instructor i); /** * Removes an instructor from the DB. * * @param i * instructor to remove */ /* pre: // // Delete the given instructor record from the given InstructorDB. The given // instructor must already be in the input db. // instructors.contains(i); post: // // A course is in the output data if and only if it is the new // course to be added or it is in the input data. // forall ( Instructor i_other ; (instructors'.contains(i_other)) iff !i_other.equals(i) && instructors.contains(i_other)); */ public abstract void removeInstructor(Instructor i); /** * Returns sorted list of Instructors. */ /*@ * post: * // The output list is sorted lexicographically by name of * // Instructor, according to the semantics of * // java.lang.String.compareto(). * // * * forall (int i; (i>=0) && (i < return.size() - 1); * return.get(i).name.first.compareTo(return.get(i + 1).name.first) < 0); * @*/ public abstract List viewInstructors(); }