Package Databases
Class DoctorSchedule
java.lang.Object
Common.Database
Databases.DoctorSchedule
The
DoctorSchedule
class manages the schedule of a specific doctor.
It extends Database
and provides methods for creating, searching,
removing, and sorting appointment slots.-
Field Summary
Fields inherited from class Common.Database
csvPath, headerFormat, records
-
Constructor Summary
ConstructorsConstructorDescriptionDoctorSchedule
(String doctor_id) Constructs aDoctorSchedule
for a specific doctor. -
Method Summary
Modifier and TypeMethodDescriptioncreateDatabaseItem
(String[] values) Creates a newAppointmentSlot
instance from an array of values.static void
deleteDoctorFile
(String doctor_id) Deletes the CSV file associated with a specific doctor.static void
Creates a new CSV file for a new doctor with the specified ID.void
Prints all items in the doctor's schedule.boolean
removeItem
(String appointment_id) Removes an appointment slot by its ID.searchItem
(String id) Searches for an appointment slot by its ID.void
Sorts appointment slots in ascending order based on date and start time.void
Overrides the storing function to sort appointment slots before saving to CSV.Methods inherited from class Common.Database
addItem, extractFromCSV, getRecords, printItems, setcsvPath, setHeaderFormat
-
Constructor Details
-
DoctorSchedule
Constructs aDoctorSchedule
for a specific doctor.- Parameters:
doctor_id
- the unique identifier of the doctor
-
-
Method Details
-
newDoctor
Creates a new CSV file for a new doctor with the specified ID.- Parameters:
doctor_id
- the unique identifier of the doctor
-
deleteDoctorFile
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 classDatabase
-
createDatabaseItem
Creates a newAppointmentSlot
instance from an array of values.- Specified by:
createDatabaseItem
in classDatabase
- Parameters:
values
- an array of strings containing appointment slot data- Returns:
- a new
AppointmentSlot
object
-
searchItem
Searches for an appointment slot by its ID.- Specified by:
searchItem
in classDatabase
- Parameters:
id
- the unique identifier of the appointment slot to search for- Returns:
- the found
AppointmentSlot
object; null if not found
-
removeItem
Removes an appointment slot by its ID.- Specified by:
removeItem
in classDatabase
- 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 classDatabase
-
sortAppointments
public void sortAppointments()Sorts appointment slots in ascending order based on date and start time.
-