package file; import caldb.UserCalendar; /** * Class File and its related classes derive from Section 2.7 of the * requirements, which in turn derives from the commands on the 'File' menu. *

* A File is an abstraction of a file stored in the file space. It has a name, * permissions, type, and data. These are the components sufficient to specify * the behavior of Calendar Tool file operations. */ public class File { /** The string representation of a file name is an abstraction of file * names used in specific operating environments. Implementations may * obey any syntactic or semantic constraints imposed by a particular * environment. */ String name; /** FilePermissions indicate whether a file is readable and/or writable. */ FilePermissions permissions; /** File type is either "calendar" or "other". */ FileType type; /** The size in megabytes of a file. This concrete measure is used here * instead of number of calendar elements since at this level we are * concerned with physical file storage, not logical number of items. */ int size; /** File data is defined abstractly as a UserCalendar. In the concrete * implementation, these data will be serialized or otherwise suitably * represented to be stored on a concrete file storage medium. */ FileData data; } /** * Permissions are an abstract of what is typically available in an * operating system. All that is necessary for the Calendar Tool spec are * two booleans specifying file readability and writeability. */ enum FilePermissions {IsReadable, IsWritable} /** * The type of file data is either CalendarType data (which we care about), * SettingsType data (which we also care about), or any other type of data * (which we don't care about). */ enum FileType {CalendarType, OtherType} /** * The abstract representation of calendar-type FileData is a UserCalendar * object. Calendar Tool implementors may use any concrete file data * representation that accurately holds all UserCalendar components. */ abstract class FileData extends UserCalendar {}