Package Controllers.AMManagers
Class DoctorAM
java.lang.Object
Controllers.AMManagers.DoctorAM
The
DoctorAM
class manages appointment-related functionalities for doctors.
It provides methods for validating dates and times, generating appointment slots,
and managing appointment requests.-
Constructor Summary
ConstructorsConstructorDescriptionDoctorAM
(DoctorSchedule doctorSchedule) Constructs aDoctorAM
with the specified doctor's schedule. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptRequest
(AppointmentSlot slot) Accepts an appointment slot request and updates its status to CONFIRMED.convertHours
(int hours) Converts an hour to a time format string (HH:00).void
generateTimeSlot
(String doctorID, LocalDate date, String startTime, String endTime) Generates hourly appointment slots for a doctor between specified start and end times.Retrieves all available appointment slots from the doctor's schedule.getSlotWithAppID
(String AppID) Retrieves a specific appointment slot by its ID.boolean
isAppIDExist
(String slotID) Checks if an appointment ID exists in the doctor's schedule.boolean
isEndTimeAfterStart
(int startHours, int endHours) Checks if the end hour is after the start hour.boolean
isValidDate
(int year, int month, int day) Checks if the provided date is valid.boolean
isValidHour
(int hours) Checks if the provided hour is within valid working hours (8 AM to 6 PM).void
rejectRequest
(AppointmentSlot slot) Rejects an appointment slot request and updates its status to DECLINED.
-
Constructor Details
-
DoctorAM
Constructs aDoctorAM
with the specified doctor's schedule.- Parameters:
doctorSchedule
- theDoctorSchedule
associated with the doctor
-
-
Method Details
-
isValidDate
public boolean isValidDate(int year, int month, int day) Checks if the provided date is valid.- Parameters:
year
- the year of the datemonth
- the month of the dateday
- the day of the date- Returns:
- true if the date is valid; false otherwise
-
isValidHour
public boolean isValidHour(int hours) Checks if the provided hour is within valid working hours (8 AM to 6 PM).- Parameters:
hours
- the hour to check- Returns:
- true if the hour is valid; false otherwise
-
isEndTimeAfterStart
public boolean isEndTimeAfterStart(int startHours, int endHours) Checks if the end hour is after the start hour.- Parameters:
startHours
- the starting hourendHours
- the ending hour- Returns:
- true if end hour is after start hour; false otherwise
-
convertHours
Converts an hour to a time format string (HH:00).- Parameters:
hours
- the hour to convert- Returns:
- a string representing the time in HH:00 format
-
isAppIDExist
Checks if an appointment ID exists in the doctor's schedule.- Parameters:
slotID
- the unique identifier of the appointment slot- Returns:
- true if the appointment ID exists; false otherwise
-
generateTimeSlot
Generates hourly appointment slots for a doctor between specified start and end times.- Parameters:
doctorID
- the unique identifier of the doctordate
- the date for which to generate slotsstartTime
- the starting time for generating slots (in HH:mm format)endTime
- the ending time for generating slots (in HH:mm format)
-
acceptRequest
Accepts an appointment slot request and updates its status to CONFIRMED.- Parameters:
slot
- theAppointmentSlot
to accept
-
rejectRequest
Rejects an appointment slot request and updates its status to DECLINED.- Parameters:
slot
- theAppointmentSlot
to reject
-
getAvailableSlots
Retrieves all available appointment slots from the doctor's schedule.- Returns:
- a list of available
AppointmentSlot
objects; null if no schedule found
-
getSlotWithAppID
Retrieves a specific appointment slot by its ID.- Parameters:
AppID
- the unique identifier of the appointment slot- Returns:
- an
AppointmentSlot
object if found; null otherwise
-