Record Class MatchingRoomDTO

java.lang.Object
java.lang.Record
de.gustavblass.fsu.fmi.roombooking.dto.MatchingRoomDTO
Record Components:
number - The Room.number.
type - The Room.getType().
status - Whether the Room is occupied or available for use.
score - The result of the Reservation.matches(Room) method.
capacity - The Room.capacity.
maximumOccupancy - At most this many seats are occupied in the Room during the time period in question.
individualEquipment - The Room.equipment.
commonEquipment - The Room.equipment if the Room is a ConferenceRoom. Null otherwise.
accessibility - The Room.accessibility.
All Implemented Interfaces:
Comparable<MatchingRoomDTO>

public record MatchingRoomDTO(@NonNull String number, @NonNull RoomType type, @NonNull RoomStatus status, double score, int capacity, @Nullable Integer maximumOccupancy, @NonNull Set<IndividualEquipmentDTO> individualEquipment, @Nullable Set<String> commonEquipment, @Nullable Accessibility accessibility) extends Record implements Comparable<MatchingRoomDTO>
Data-transfer object that represents a Room that was found when looking for matching Rooms for a Reservation.
  • Field Details

    • number

      @NonNull private final @NonNull String number
      The field for the number record component.
    • type

      @NonNull private final @NonNull RoomType type
      The field for the type record component.
    • status

      @NonNull private final @NonNull RoomStatus status
      The field for the status record component.
    • score

      private final double score
      The field for the score record component.
    • capacity

      private final int capacity
      The field for the capacity record component.
    • maximumOccupancy

      @Nullable private final @Nullable Integer maximumOccupancy
      The field for the maximumOccupancy record component.
    • individualEquipment

      @NonNull private final @NonNull Set<IndividualEquipmentDTO> individualEquipment
      The field for the individualEquipment record component.
    • commonEquipment

      @Nullable private final @Nullable Set<String> commonEquipment
      The field for the commonEquipment record component.
    • accessibility

      @Nullable private final @Nullable Accessibility accessibility
      The field for the accessibility record component.
  • Constructor Details

    • MatchingRoomDTO

      public MatchingRoomDTO(@NonNull @NonNull String number, @NonNull @NonNull RoomType type, @NonNull @NonNull RoomStatus status, double score, int capacity, @Nullable @Nullable Integer maximumOccupancy, @NonNull @NonNull Set<IndividualEquipmentDTO> individualEquipment, @Nullable @Nullable Set<String> commonEquipment, @Nullable @Nullable Accessibility accessibility)
      Creates an instance of a MatchingRoomDTO record class.
      Parameters:
      number - the value for the number record component
      type - the value for the type record component
      status - the value for the status record component
      score - the value for the score record component
      capacity - the value for the capacity record component
      maximumOccupancy - the value for the maximumOccupancy record component
      individualEquipment - the value for the individualEquipment record component
      commonEquipment - the value for the commonEquipment record component
      accessibility - the value for the accessibility record component
  • Method Details

    • compareTo

      public int compareTo(@NonNull @NonNull MatchingRoomDTO other)
      Determines which of the two MatchingRoomDTOs (this one and the given one) should be named first in a list. Generally, the DTO with the smaller (i.e. worse) score comes first.
      Specified by:
      compareTo in interface Comparable<MatchingRoomDTO>
      Parameters:
      other - The DTO to which this one shall be compared.
      Returns:
      Negative if this DTO should come first. Positive if the other DTO should come first. Zero if it does not matter because both are equal.
    • equals

      public boolean equals(@Nullable @Nullable Object object)
      Deeply checks whether the fields of this MatchingRoomDTO have the same values as those of the given DTO.
      Specified by:
      equals in class Record
      Parameters:
      object - The other DTO to which this object shall be compared.
      Returns:
      True if there are no differences, false otherwise.
    • 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
    • number

      @NonNull public @NonNull String number()
      Returns the value of the number record component.
      Returns:
      the value of the number record component
    • type

      @NonNull public @NonNull RoomType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • status

      @NonNull public @NonNull RoomStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • score

      public double score()
      Returns the value of the score record component.
      Returns:
      the value of the score record component
    • capacity

      public int capacity()
      Returns the value of the capacity record component.
      Returns:
      the value of the capacity record component
    • maximumOccupancy

      @Nullable public @Nullable Integer maximumOccupancy()
      Returns the value of the maximumOccupancy record component.
      Returns:
      the value of the maximumOccupancy record component
    • individualEquipment

      @NonNull public @NonNull Set<IndividualEquipmentDTO> individualEquipment()
      Returns the value of the individualEquipment record component.
      Returns:
      the value of the individualEquipment record component
    • commonEquipment

      @Nullable public @Nullable Set<String> commonEquipment()
      Returns the value of the commonEquipment record component.
      Returns:
      the value of the commonEquipment record component
    • accessibility

      @Nullable public @Nullable Accessibility accessibility()
      Returns the value of the accessibility record component.
      Returns:
      the value of the accessibility record component