package database; import java.util.Collection; /** * This class is derived from section 2.3.2. * * CourseList is the repository of Course information. * @author kdavis22 */ abstract class CourseList { /** * The collection of Courses. */ Collection data; /** * Add the given Course to the given CourseList. The courseNumber of the given Course * must not be the same as a Course already on the CourseList. The Course must have a * CourseType, department, name, wtus and credits. */ /*@ ensures // // A Course is on the output CourseList if and only if it is the new Course // to be added or it is in the input CourseList. // (\forall Course courOther ; data.contains(courOther) <==> courOther.equals(cour) || \old(data).contains(courOther)); @*/ abstract void add(Course cour); /** * Remove the given Course from the given CourseList. The given Course must already be * on the CourseList. */ /*@ requires // // The given Course is in the given CourseList. // data.contains(cour); ensures // // A Course is in the output CourseList if and only if it is not the existing // Course to be deleted and it is in the input CourseList. // (\forall Course courOther ; data.contains(courOther) <==> !courOther.equals(cour) && \old(data).contains(courOther)); @*/ abstract void remove(Course cour); /** * Change the old Course to the new Course. The old and new Courses must not be the * same. The old Record must already be on the CourseList. The new Course must meet * the same conditions as for the input to the AddCourse operation. */ /*@ requires // // The old and new Courses are not the same. // !oldCour.equals(newCour); ensures // // A Course is in the output CourseList if and only if it is the new Course // to be added or it is in the input CourseList, and it is not the old Course. // (\forall Course courOther ; data.contains(courOther) <==> courOther.equals(newCour) || \old(data).contains(courOther) && !courOther.equals(oldCour)); @*/ abstract void change(Course oldCour, Course newCour); }