Interface LocalDayPlan


public interface LocalDayPlan
Timezone and day based view on timeline. This is the classic view on a day plan or calendar in which entries are added and viewed in local time. A LocalDayPlan has two local time boundaries for allowed times, start time and end time, which default to 0:00 (inclusive) and 24:00 exclusive. The implementer should implement a toString that shows all appointments based on local time. It is left to the discretion of the implementer to also show the gaps.
Author:
Pieter van den Hombergh p.vandenhombergh@fontys.nl
  • Method Details

    • day

      LocalDay day()
      LocalDay specifies date and time zone.
      Returns:
      the day
    • startOfDay

      Instant startOfDay()
      Start time of the day, inclusive.
      Returns:
      instant representing the start of the day
    • endOfDay

      Instant endOfDay()
      End time of the day, exclusive. E.g. when end time is 17.30, in that minute no new appointment (of 1 minute) can be added.
      Returns:
      instant representing the end of the day
    • timeline

      Timeline timeline()
      Get the timeline used by this LocalDayPlan.
      Returns:
      the timeline used by this LocalDayPlan
    • startTime

      default LocalTime startTime()
      Get the allowed first time for this day.
      Returns:
      the start time of this plan
    • endTime

      default LocalTime endTime()
      Get the allowed latest time for this day.
      Returns:
      the end time in this plan
    • addAppointment

      default Optional<Appointment> addAppointment(AppointmentData appointmentData, LocalTime start, TimePreference fallback)
      Add an appointment with start time and fallback time preference.
      Parameters:
      appointmentData - the appointment data
      start - if not null, preferred start time
      fallback - if start cannot be met, use as preference for fallback
      Returns:
      an optional of Appointment, which is present when the appointment was created successfully, or empty when not successful.
    • addAppointment

      default Optional<Appointment> addAppointment(AppointmentData appointmentData, LocalTime startTime)
      Add and appointment with fix start time. This request can fail (Optional is not present) if the start time is not available.
      Parameters:
      appointmentData - data
      startTime - fixed time
      Returns:
      Optional Appointment
    • addAppointment

      default Optional<Appointment> addAppointment(AppointmentData appointmentData, TimePreference preference)
      Add and appointment with time preference. This request can fail (Optional is not present) if the data's duration does not fit in the (already planned day). This method only supports TimePreferences EARLIEST or LATEST; Other values are defaulted to EARLIEST
      Parameters:
      appointmentData - data
      preference - time preference
      Returns:
      Optional Appointment
    • removeAppointment

      default AppointmentRequest removeAppointment(Appointment appointment)
      Parameters:
      appointment - the appointment to remove
      Returns:
      AppointmentRequest, the original appointment request
    • removeAppointments

      default List<AppointmentRequest> removeAppointments(Predicate<Appointment> filter)
      Parameters:
      filter - to remove all appointments that match
      Returns:
      all appointment requests of removed appointments
    • appointments

      default List<Appointment> appointments()
      Returns:
      all appointments
    • findMatchingFreeSlotsOfDuration

      default List<TimeSlot> findMatchingFreeSlotsOfDuration(Duration duration, List<LocalDayPlan> plans)
      Parameters:
      duration - Minimum duration of the slots
      plans - that could have common gaps
      Returns:
      the list of gaps this and each of the other plans have in common with a minimum length of duration.
    • findGapsFitting

      default List<TimeSlot> findGapsFitting(Duration duration)
      Parameters:
      duration - the minimum duration that should fit
      Returns:
      list of timeslots that fit the duration
    • findGapsFittingReversed

      default List<TimeSlot> findGapsFittingReversed(Duration duration)
      Parameters:
      duration - the minimum duration that should fit
      Returns:
      list of timeslots that fit the duration
    • findGapsFittingLargestFirst

      default List<TimeSlot> findGapsFittingLargestFirst(Duration duration)
      Parameters:
      duration - the minimum duration
      Returns:
      list of gaps fitting the duration
    • findGapsFittingSmallestFirst

      default List<TimeSlot> findGapsFittingSmallestFirst(Duration duration)
      Parameters:
      duration - the minimum duration
      Returns:
      list of timeslots fitting the duration
    • canAddAppointmentOfDuration

      default boolean canAddAppointmentOfDuration(Duration duration)
      Parameters:
      duration - the minimum duration
      Returns:
      true of a gap is available, false otherwise
    • findAppointments

      default List<Appointment> findAppointments(Predicate<Appointment> filter)
      Parameters:
      filter - to find appointments
      Returns:
      list of appointments that fit the filter
    • toString

      String toString()
      Return a string containing the local date, the time zone and all appointments in natural order, presented with time as local time.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the local day plan.
    • contains

      default boolean contains(Appointment appointment)
      Parameters:
      appointment - the appointment to check
      Returns:
      true if present, false otherwise
    • date

      default LocalDate date()
      What is the (start) date of this plan.
      Returns:
      the date according to this LocalDayPlan's time zone
    • nrOfAppointments

      default int nrOfAppointments()
      Returns:
      number of appointments
    • at

      default Instant at(int hour, int minute)
      Get the instant at the given hour and minute of this local day plan.
      Parameters:
      hour - sic
      minute - sic
      Returns:
      the point in time as Instant