package Info; import java.util.Collection; /** Represents a group of classes, representing the top level of a users gradebook. */ public abstract class ClassGroup { /** * The collection of user classes. */ public Collection classes; /** * The user of this class group. */ public User user; /** * Add the given UserClass to the given ClassGroup. The class name * must not be the same as a UserClass already in the ClassGroup. */ /*@ requires // // There is no user class in the input ClassGroup // with the same class name as the user class to be added. // (! (\exists UserClass aClass ; classes.contains(aClass) ; aClass.basicInfo.className.equals(newClass.basicInfo.className))); ensures // // If preconditions are met, a user class is in the output classes if and only // if it is the new class to be added or it is in the input classes. // (\forall UserClass aClass ; (classes.contains(aClass)) <==> aClass.equals(newClass) || \old(classes).contains(aClass)); @*/ public abstract void addClass(UserClass newClass); /** * Deletes the given UserClass from the given ClassGroup. */ /*@ requires // // The passed user class to be deleted is a user class in the input ClassGroup. // ((\exists UserClass aClass ; classes.contains(aClass) ; aClass.equals(toRemove))); ensures // // If preconditions are met, a user class is in the output classes if and only // if it is not the existing class to be deleted or it is in the input classes. // (\forall UserClass aClass ; (classes.contains(aClass)) <==> !aClass.equals(toRemove) && \old(classes).contains(aClass)); @*/ public abstract void deleteClass(UserClass toRemove); }