package caltool.schedule; import caltool.caldb.*; /**** * * An Event is the simplest type of ScheduledItem. The only component it adds * to a ScheduledItem is simple security. * * @author Gene Fisher (gfisher@calpoly.edu) * @version 6feb04 * */ public class Event extends ScheduledItem { /** * Construct an empty event. */ public Event() { } /** * Construct an event with the given field values. Generate and store the * unique key for this event. */ public Event(String title, Date startOrDueDate, Date endDate, Category category, SimpleSecurity security) { this.title = title; this.startOrDueDate = startOrDueDate; this.endDate = endDate; this.category = category; this.security = security; itemKey = new ItemKey(startOrDueDate, null, null, title, 0); } /*-* * Access methods. */ /** * Return the title. */ public String getTitle() { return title; } /** * Return the start date. */ public Date getStartDate() { return startOrDueDate; } /** * Return the end date. */ public Date getEndDate() { return endDate; } /*-* * Process methods */ /** * Return the unique key for this, consisting of date and title. Time, * duration, and priority are unused. */ public ItemKey getKey() { return itemKey; } /** * Convert this to a string. */ public String toString() { return "\n" + "Title: " + title + "\n" + "Start date: " + startOrDueDate.toString() + "\n" + "End date: " + (endDate == null ? "" : endDate.toString()) + "\n" + "Category: " + (category == null ? "" : category.toString()) + "\n" + "Security: " + security + "\n"; } /*-* * Derived data field */ /** Whether the event is public or private. */ protected SimpleSecurity security; /*-* * Process data field */ /** The uniqe key for storing this in the UserCalendar items list */ protected ItemKey itemKey; }