java.lang.Object
java.lang.Record
com.cta4j.bus.model.Bus
- Record Components:
id- the unique identifier of the busroute- the route identifier the bus is servingdestination- the destination of the buscoordinates- the coordinates and heading of the busarrivals- the list of upcoming bus arrivals for the busdelayed- whether the bus is currently delayed
public record Bus(String id, String route, String destination, BusCoordinates coordinates, List<UpcomingBusArrival> arrivals, Boolean delayed)
extends Record
A bus currently in service.
-
Constructor Summary
ConstructorsConstructorDescriptionBus(String id, String route, String destination, BusCoordinates coordinates, List<UpcomingBusArrival> arrivals, Boolean delayed) Creates an instance of aBusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionarrivals()Returns the value of thearrivalsrecord component.Returns the value of thecoordinatesrecord component.delayed()Returns the value of thedelayedrecord component.Returns the value of thedestinationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.route()Returns the value of therouterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Bus
public Bus(String id, String route, String destination, BusCoordinates coordinates, List<UpcomingBusArrival> arrivals, Boolean delayed) Creates an instance of aBusrecord class.- Parameters:
id- the value for theidrecord componentroute- the value for therouterecord componentdestination- the value for thedestinationrecord componentcoordinates- the value for thecoordinatesrecord componentarrivals- the value for thearrivalsrecord componentdelayed- the value for thedelayedrecord component
-
-
Method Details
-
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. -
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. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
route
Returns the value of therouterecord component.- Returns:
- the value of the
routerecord component
-
destination
Returns the value of thedestinationrecord component.- Returns:
- the value of the
destinationrecord component
-
coordinates
Returns the value of thecoordinatesrecord component.- Returns:
- the value of the
coordinatesrecord component
-
arrivals
Returns the value of thearrivalsrecord component.- Returns:
- the value of the
arrivalsrecord component
-
delayed
Returns the value of thedelayedrecord component.- Returns:
- the value of the
delayedrecord component
-