Record Class TimespanOverlapItem
java.lang.Object
java.lang.Record
de.gustavblass.fsu.fmi.roombooking.model.room.schedule.TimespanOverlapItem
- Record Components:
type- Whether the SeatReservation starts or ends at the settime.time- When the SeatReservation starts/ends (depending on thetype).value- How many seats in theReservation.roomare occupied during the SeatReservation's timespan.
- All Implemented Interfaces:
Comparable<TimespanOverlapItem>
public record TimespanOverlapItem(@NonNull TimespanOverlapItem.Type type, @NonNull LocalTime time, int value)
extends Record
implements Comparable<TimespanOverlapItem>
Useful to convert a collection of SeatReservations into a
RoomSchedule.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumIndicates whether theTimespanOverlapItemstarts or ends at the settime. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimespanOverlapItem(@NonNull TimespanOverlapItem.Type type, @NonNull LocalTime time, int value) Creates an instance of aTimespanOverlapItemrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(@NonNull TimespanOverlapItem other) Alias forLocalDateTime.compareTo(ChronoLocalDateTime)on thetime.intcompareTo(@NonNull TimespanOverlapItem other, @NonNull Comparator<TimespanOverlapItem.Type> typeComparator) Compares thisTimespanOverlapItemto another one based on thetimefield.intcompareToWithInverseType(@NonNull TimespanOverlapItem other) Compares thisTimespanOverlapItemto another one based on thetimefield.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NonNull LocalTimetime()Returns the value of thetimerecord component.final StringtoString()Returns a string representation of this record class.@NonNull TimespanOverlapItem.Typetype()Returns the value of thetyperecord component.intvalue()Returns the value of thevaluerecord component.
-
Field Details
-
Constructor Details
-
TimespanOverlapItem
public TimespanOverlapItem(@NonNull @NonNull TimespanOverlapItem.Type type, @NonNull @NonNull LocalTime time, int value) Creates an instance of aTimespanOverlapItemrecord class.
-
-
Method Details
-
compareTo
Alias forLocalDateTime.compareTo(ChronoLocalDateTime)on thetime.- Specified by:
compareToin interfaceComparable<TimespanOverlapItem>
-
compareToWithInverseType
@Contract(pure=true) public int compareToWithInverseType(@NonNull @NonNull TimespanOverlapItem other) Compares thisTimespanOverlapItemto another one based on thetimefield. If both are equal, then this method falls back to theTimespanOverlapItem.Type.inverseComparator(TimespanOverlapItem.Type)of thetype.- Parameters:
other- The object that this one shall be compared to.- Returns:
- If this object comes first, less than zero. If the other object comes first, greater than zero. If both
have the same time, then the result of
TimespanOverlapItem.Type.inverseComparator(TimespanOverlapItem.Type).
-
compareTo
@Contract(pure=true) public int compareTo(@NonNull @NonNull TimespanOverlapItem other, @NonNull @NonNull Comparator<TimespanOverlapItem.Type> typeComparator) Compares thisTimespanOverlapItemto another one based on thetimefield. If both are equal, then this method falls back to the givenComparator.- Parameters:
other- The object that this one shall be compared to.typeComparator- Will be used if both objects have the same time.- Returns:
- If this object comes first, less than zero. If the other object comes first, greater than zero. If both have the same time, then the result of the given comparator.
-
toString
-
hashCode
-
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
-
time
-
value
-