001package edu.pdx.cs410J; 002 003import java.io.Serializable; 004import java.time.ZonedDateTime; 005import java.util.Date; 006 007/** 008 * This class represents an appointment found in an appointment book. 009 * Each appointment has a beginning and ending time, as well as a text 010 * message describing itself. 011 * 012 * @author David Whitlock 013 */ 014public abstract class AbstractAppointment implements Serializable 015{ 016 017 /** 018 * Returns a String describing the beginning date and time of this 019 * appointment. 020 */ 021 public abstract String getBeginTimeString(); 022 023 /** 024 * Returns a String describing the ending date and time of this 025 * appointment. 026 */ 027 public abstract String getEndTimeString(); 028 029 /** 030 * Returns the {@link Date} that this appointment begins. 031 */ 032 public ZonedDateTime getBeginTime() { 033 return null; 034 } 035 036 /** 037 * Returns the {@link Date} that this appointment ends. 038 */ 039 public ZonedDateTime getEndTime() { 040 return null; 041 } 042 043 /** 044 * Returns a description of this appointment (for instance, 045 * <code>"Have coffee with Marsha"</code>). 046 */ 047 public abstract String getDescription(); 048 049 /** 050 * Returns a brief textual summary of this appointment. 051 */ 052 public final String toString() { 053 return this.getDescription() + " from " + 054 this.getBeginTimeString() + " until " + this.getEndTimeString(); 055 } 056 057}