package schedule; import java.util.Collection; /** * The Calendar object is derived from an overall view of Sections 2.1 through * 2.5 of the requirements. The functionality described in those sections * makes it clear that a Calendar is the primary data object of the Calendar * Tool. *
* The data component of a Calendar is a collection of scheduled items. The
* operations are those that schedule each of the four types of scheduled
* item. In the case of meetings, there are two operations involved -- one to
* compute a list of possible times, and another to confirm a specific selected
* meeting time.
*/
public abstract class Calendar {
Collection
pre:
//
// The Title field is not empty.
//
(event.title != null && event.title.length() >= 1)
&&
//
// The startOrDueDate field is a valid date value.
//
(event.startOrDueDate != null) && event.startOrDueDate.isValid()
&&
//
// If non-empty, the EndDate field is a valid date value.
//
(event.endDate != null) ==> event.endDate.isValid()
&&
//
// No event of same startDate and title is in the current calendar.
//
! exists (ScheduledItem item ;
data.contains(item) ;
(item.startOrDueDate.equals(event.startOrDueDate)) &&
(item.title.equals(event.title)));
post:
//
// If preconds met, a scheduled item is in the output calendar if
// and only if it is the new appt to be added or it is in the
// input calendar.
//
forall (ScheduledItem item;
data'.contains(item) iff
(item == event ||
data.contains(item)));
*
*/
abstract void scheduleEvent(Event event);
}