Record Class RoomSchedule

java.lang.Object
java.lang.Record
de.gustavblass.fsu.fmi.roombooking.model.room.schedule.RoomSchedule
Record Components:
date - The day for which this schedule is valid.
schedule - The Reservations placed for a specific Room on the date.

public record RoomSchedule(@NonNull LocalDate date, @NonNull @Unmodifiable List<RoomScheduleItem> schedule) extends Record
A Room's Reservation timeline for a specific date.
  • Field Details

    • date

      @NonNull private final @NonNull LocalDate date
      The field for the date record component.
    • schedule

      @NonNull private final @NonNull @Unmodifiable List<RoomScheduleItem> schedule
      The field for the schedule record component.
  • Constructor Details

  • Method Details

    • getOccupiedPeriods

      @Contract(pure=true) @NonNull public @NonNull @Unmodifiable List<RoomScheduleItem> getOccupiedPeriods()
      Returns:
      Only those time periods of the date during which there is a non-SeatReservation Reservation for this schedule's Room.
    • getPartiallyOrFullyOccupiedPeriods

      @Contract(pure=true) @NonNull public @NonNull @Unmodifiable List<RoomScheduleItem> getPartiallyOrFullyOccupiedPeriods()
      Returns:
      Only those time periods of the date during which there is a Reservation for this schedule's Room.
    • getFreePeriods

      @Contract(pure=true) @NonNull public @NonNull @Unmodifiable List<RoomScheduleItem> getFreePeriods()
      Returns:
      Only those time periods of the date during which there are no Reservations for this schedule's Room.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • date

      @NonNull public @NonNull LocalDate date()
      Returns the value of the date record component.
      Returns:
      the value of the date record component
    • schedule

      @NonNull public @NonNull @Unmodifiable List<RoomScheduleItem> schedule()
      Returns the value of the schedule record component.
      Returns:
      the value of the schedule record component