package schedule; import java.util.Collection; /** * This class defines a Collection of TimeConstraints set by the admin. * The methods defined will cover the basic operations on time constraints, * setting and removing constraints. * <p> * This object is derived from Section 2.4.1.1 of the Functional Requirements. */ abstract class AdminTimeConstraint { Collection<TimeConstraint> constraints; /** * A private class that defines a start and end time for a constraint. */ private abstract class TimeConstraint { int start; int end; } /** * This method is called each time an admin sets a fixed time constraint. */ /*@ requires // // The start and end times are not null // (startTime != null) && (endTime != null); ensures // // the start and end times are set // (start == startTime) && (end == endTime); @*/ public abstract void SetTimeConstraint(int startTime, int endTime); /** * This method is called whenever an admin chooses to remove a time constraint. */ /*@ requires // // The start and end selected to remove times are not null // (startTime != null) && (endTime != null); ensures // // the start and end times to be removed are removed and set to null // (start == null) && (end == null); @*/ public abstract void RemoveConstraint(int startTime, int endTime); }