Package Databases

Class DoctorSchedule

java.lang.Object
Common.Database
Databases.DoctorSchedule

public class DoctorSchedule extends Database
The DoctorSchedule class manages the schedule of a specific doctor. It extends Database and provides methods for creating, searching, removing, and sorting appointment slots.
  • Constructor Details

    • DoctorSchedule

      public DoctorSchedule(String doctor_id)
      Constructs a DoctorSchedule for a specific doctor.
      Parameters:
      doctor_id - the unique identifier of the doctor
  • Method Details

    • newDoctor

      public static void newDoctor(String doctor_id)
      Creates a new CSV file for a new doctor with the specified ID.
      Parameters:
      doctor_id - the unique identifier of the doctor
    • deleteDoctorFile

      public static void deleteDoctorFile(String doctor_id)
      Deletes the CSV file associated with a specific doctor.
      Parameters:
      doctor_id - the unique identifier of the doctor
    • storeToCSV

      public void storeToCSV()
      Overrides the storing function to sort appointment slots before saving to CSV.
      Overrides:
      storeToCSV in class Database
    • createDatabaseItem

      public DatabaseItems createDatabaseItem(String[] values)
      Creates a new AppointmentSlot instance from an array of values.
      Specified by:
      createDatabaseItem in class Database
      Parameters:
      values - an array of strings containing appointment slot data
      Returns:
      a new AppointmentSlot object
    • searchItem

      public DatabaseItems searchItem(String id)
      Searches for an appointment slot by its ID.
      Specified by:
      searchItem in class Database
      Parameters:
      id - the unique identifier of the appointment slot to search for
      Returns:
      the found AppointmentSlot object; null if not found
    • removeItem

      public boolean removeItem(String appointment_id)
      Removes an appointment slot by its ID.
      Specified by:
      removeItem in class Database
      Parameters:
      appointment_id - the unique identifier of the appointment slot to remove
      Returns:
      true if any record was successfully removed; false otherwise
    • printItems

      public void printItems()
      Prints all items in the doctor's schedule.
      Specified by:
      printItems in class Database
    • sortAppointments

      public void sortAppointments()
      Sorts appointment slots in ascending order based on date and start time.