package admin; import java.util.Collection; /** * A courseDB object is generated by the * CourseDB generator and contains records * relating to all the courses. * @author isellar */ public abstract class CourseDB{ /** * The collection of courses that have been added to the database */ public Collection courseDB; /** * The add function add a course to the temporary database */ /*@ requires // // The course title is unique and not null // (course.title != null && ! (\exists Course c; courseDB.contains(c); (c.title.equals(course.title)))) && // // The course department is not empty // If there is a reason to have a course outside a department // then the user must create a department representing that // (course.dept != null) && // // The course number does not already exist in the department // ! (\exists Course c; courseDB.contains(c); (c.dept.equals(course.dept)) && (c.number==course.number)) && // // The course description is not null // (course.description != null); ensures // // If preconditions are met, than a new course is added // to the temporary course database. // (\forall Course c; \old(courseDB.contains(c)) || c.equals(course)); @*/ public abstract void add(Course course); /** * The remove function will remove the course from the database */ /*@ requires // // The given course exists in the course database // (\exists Course c; courseDB.contains(c); (c.equals(course))); ensures // // If preconditions are met, then the couse will be removed from the database // (\forall Course c_item; courseDB.contains(c_item) <==> c_item.equals(course) && \old(courseDB).contains(c_item)); @*/ public abstract void remove(Course course); public abstract boolean contains(Course course); }