Package DatabaseItems

Class AppointmentSlot

java.lang.Object
DatabaseItems.AppointmentSlot
All Implemented Interfaces:
DatabaseItems

public class AppointmentSlot extends Object implements DatabaseItems
The AppointmentSlot class represents a time slot for an appointment. It includes details such as appointment ID, patient ID, doctor ID, date, start time, end time, and the status of the appointment.
  • Constructor Details

    • AppointmentSlot

      public AppointmentSlot(String doctor_id, String date, String timestart, String timeend, AppointmentStatus status)
      Constructs an AppointmentSlot with specified details when both patient ID and appointment ID are not provided.
      Parameters:
      doctor_id - the unique identifier for the doctor
      date - the date of the appointment
      timestart - the start time of the appointment
      timeend - the end time of the appointment
      status - the status of the appointment
    • AppointmentSlot

      public AppointmentSlot(String appointment_id, String patient_id, String doctor_id, String date, String timestart, String timeend, AppointmentStatus status)
      Constructs an AppointmentSlot with specified details when both patient ID and appointment ID are provided.
      Parameters:
      appointment_id - the unique identifier for the appointment
      patient_id - the unique identifier for the patient
      doctor_id - the unique identifier for the doctor
      date - the date of the appointment
      timestart - the start time of the appointment
      timeend - the end time of the appointment
      status - the status of the appointment
    • AppointmentSlot

      public AppointmentSlot(String patient_id, String doctor_id, String date, String timestart, String timeend, AppointmentStatus status)
      Constructs an AppointmentSlot with specified details when only patient ID is provided.
      Parameters:
      patient_id - the unique identifier for the patient
      doctor_id - the unique identifier for the doctor
      date - the date of the appointment
      timestart - the start time of the appointment
      timeend - the end time of the appointment
      status - the status of the appointment
    • AppointmentSlot

      public AppointmentSlot(String... params)
      Constructs an AppointmentSlot by deserializing from a set of parameters.
      Parameters:
      params - an array of strings containing appointment details in order: appointment_id, patient_id, date, timestart, timeend, status
  • Method Details

    • deserialise

      public void deserialise(String... params)
      Deserializes appointment details from a string array.
      Specified by:
      deserialise in interface DatabaseItems
      Parameters:
      params - an array of strings containing appointment details in order: appointment_id, patient_id, date, timestart, timeend, status
    • serialise

      public String serialise()
      Serializes the appointment slot into a comma-separated string.
      Specified by:
      serialise in interface DatabaseItems
      Returns:
      a string representation of the appointment slot
    • printItem

      public void printItem()
      Prints the details of the appointment slot to standard output.
      Specified by:
      printItem in interface DatabaseItems
    • sortAppointments

      public static void sortAppointments(List<AppointmentSlot> appointments)
      Sorts a list of appointment slots by date and start time.
      Parameters:
      appointments - a list of AppointmentSlot objects to be sorted
    • getAppointmentId

      public String getAppointmentId()
      Returns the unique identifier for the appointment.
      Returns:
      the appointment ID
    • getPatientId

      public String getPatientId()
      Returns the unique identifier for the patient associated with this slot.
      Returns:
      the patient ID
    • getDate

      public String getDate()
      Returns the date of the appointment.
      Returns:
      the date of the appointment
    • getTimestart

      public String getTimestart()
      Returns the start time of the appointment.
      Returns:
      start time of appointment
    • getTimeend

      public String getTimeend()
      Returns end time of appointment.
      Returns:
      end time of appointment
    • getStatus

      public AppointmentStatus getStatus()
      Returns current status of appointment.
      Returns:
      current status
    • getDoctorId

      public String getDoctorId()
      Returns unique identifier for associated doctor.
      Returns:
      doctor ID
    • setPatientId

      public void setPatientId(String patient_id)
      Sets a new patient ID for this slot.
      Parameters:
      patient_id - new patient ID
    • setDoctorId

      public void setDoctorId(String doctor_id)
      Sets a new doctor ID for this slot.
      Parameters:
      doctor_id - new doctor ID
    • setDate

      public void setDate(String date)
      Sets a new date for this slot.
      Parameters:
      date - new date
    • setTimestart

      public void setTimestart(String timestart)
      Sets a new start time for this slot.
      Parameters:
      timestart - new start time
    • setTimeend

      public void setTimeend(String timeend)
      Sets a new end time for this slot.
      Parameters:
      timeend - new end time
    • setStatus

      public void setStatus(AppointmentStatus status)
      Sets a new status for this slot.
      Parameters:
      status - new status