package edu.pdx.cs410J.chances;

import edu.pdx.cs410J.AbstractAppointment;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Appointment extends AbstractAppointment {
  public static final SimpleDateFormat DATE_FORMAT =
          new SimpleDateFormat("MM/dd/yyyy kk:mm");

  private Date beginTime;
  private Date endTime;
  private String description;

  /**
   * Construct a new appointment given a description.
   *
   * @param description Description of the new appointment
     */
  public Appointment(String description) {
    this.description = description;
  }

  /**
   * Get the time this appointment begins.
   */
  @Override
  public Date getBeginTime()
  {
    return beginTime;
  }

  /**
   * Set the time this appointment begins.
   */
  public void setBeginTime(Date beginTime) {
    this.beginTime = beginTime;
  }

  /**
   * Get the time this appointment ends.
   */
  @Override
  public Date getEndTime()
  {
    return endTime;
  }

  /**
   * Set the time this appointment ends.
   */
  public void setEndTime(Date endTime) {
    this.endTime = endTime;
  }

  /**
   * Get the time this appointment begins.
   *
   * @return String representation of appointment begin time
     */
  @Override
  public String getBeginTimeString() {
    return beginTime.toString();
  }

  /**
   * Get the time this appointment ends.
   *
   * @return String representation of appointment end time
   */
  @Override
  public String getEndTimeString() {
    return endTime.toString();
  }

  /**
   * Get the description of this appointment.
   *
   * @return Description of this appointment
   */
  @Override
  public String getDescription() {
    return description;
  }
}

@@ -181,16 +181,51 @@
 ointment
+ implements Comparable%3CAppointment%3E
  %7B%0A  pub
@@ -1730,11 +1730,1006 @@
 ion;%0A  %7D
+%0A%0A  /**%0A   * Compares this appointment to another.%0A   *%0A   * Appointments should be sorted chronologically by their beginning time. If%0A   * two appointment begin at the same time, they should be sorted%0A   * chronologically by their ending time. Otherwise, the two appointments%0A   * should be sorted lexicographically by their descriptions.%0A   *%0A   * @param other Appointment to compare to%0A   * @return Ordinal difference between Appointments, zero if identical%0A     */%0A  @Override%0A  public int compareTo(Appointment other) %7B%0A    int difference = 0;%0A%0A    // Compare begin times%0A    difference = this.beginTime.compareTo(other.beginTime);%0A%0A    // Compare end times if begin times are identical%0A    difference = (difference == 0) ?%0A            this.endTime.compareTo(other.endTime) : difference;%0A%0A    // Compare descriptions if begin and end times are identical%0A    difference = (difference == 0) ?%0A            this.description.compareTo(other.description) : difference;%0A%0A    return difference;%0A  %7D
 %0A%7D%0A

Make Appointment comparable