Record Class MatchingRoomDTO
java.lang.Object
java.lang.Record
de.gustavblass.fsu.fmi.roombooking.dto.MatchingRoomDTO
- Record Components:
number- TheRoom.number.type- TheRoom.getType().status- Whether the Room is occupied or available for use.score- The result of theReservation.matches(Room)method.capacity- TheRoom.capacity.maximumOccupancy- At most this many seats are occupied in the Room during the time period in question.individualEquipment- TheRoom.equipment.commonEquipment- TheRoom.equipmentif the Room is a ConferenceRoom. Null otherwise.accessibility- TheRoom.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 Summary
FieldsModifier and TypeFieldDescriptionprivate final @Nullable AccessibilityThe field for theaccessibilityrecord component.private final intThe field for thecapacityrecord component.The field for thecommonEquipmentrecord component.private final @NonNull Set<IndividualEquipmentDTO> The field for theindividualEquipmentrecord component.private final @Nullable IntegerThe field for themaximumOccupancyrecord component.private final @NonNull StringThe field for thenumberrecord component.private final doubleThe field for thescorerecord component.private final @NonNull RoomStatusThe field for thestatusrecord component.private final @NonNull RoomTypeThe field for thetyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionMatchingRoomDTO(@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) Creates an instance of aMatchingRoomDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable AccessibilityReturns the value of theaccessibilityrecord component.intcapacity()Returns the value of thecapacityrecord component.Returns the value of thecommonEquipmentrecord component.intcompareTo(@NonNull MatchingRoomDTO other) Determines which of the two MatchingRoomDTOs (this one and the given one) should be named first in a list.booleanDeeply checks whether the fields of thisMatchingRoomDTOhave the same values as those of the given DTO.final inthashCode()Returns a hash code value for this object.@NonNull Set<IndividualEquipmentDTO> Returns the value of theindividualEquipmentrecord component.@Nullable IntegerReturns the value of themaximumOccupancyrecord component.@NonNull Stringnumber()Returns the value of thenumberrecord component.doublescore()Returns the value of thescorerecord component.@NonNull RoomStatusstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.@NonNull RoomTypetype()Returns the value of thetyperecord component.
-
Field Details
-
number
-
type
-
status
The field for thestatusrecord component. -
score
private final double scoreThe field for thescorerecord component. -
capacity
private final int capacityThe field for thecapacityrecord component. -
maximumOccupancy
The field for themaximumOccupancyrecord component. -
individualEquipment
The field for theindividualEquipmentrecord component. -
commonEquipment
The field for thecommonEquipmentrecord component. -
accessibility
The field for theaccessibilityrecord 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 aMatchingRoomDTOrecord class.- Parameters:
number- the value for thenumberrecord componenttype- the value for thetyperecord componentstatus- the value for thestatusrecord componentscore- the value for thescorerecord componentcapacity- the value for thecapacityrecord componentmaximumOccupancy- the value for themaximumOccupancyrecord componentindividualEquipment- the value for theindividualEquipmentrecord componentcommonEquipment- the value for thecommonEquipmentrecord componentaccessibility- the value for theaccessibilityrecord component
-
-
Method Details
-
compareTo
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)scorecomes first.- Specified by:
compareToin interfaceComparable<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
Deeply checks whether the fields of thisMatchingRoomDTOhave the same values as those of the given DTO. -
toString
-
hashCode
-
number
-
type
-
status
-
score
-
capacity
-
maximumOccupancy
Returns the value of themaximumOccupancyrecord component.- Returns:
- the value of the
maximumOccupancyrecord component
-
individualEquipment
Returns the value of theindividualEquipmentrecord component.- Returns:
- the value of the
individualEquipmentrecord component
-
commonEquipment
Returns the value of thecommonEquipmentrecord component.- Returns:
- the value of the
commonEquipmentrecord component
-
accessibility
Returns the value of theaccessibilityrecord component.- Returns:
- the value of the
accessibilityrecord component
-