java.lang.Object
java.lang.Record
com.cta4j.model.bus.Bus
- Record Components:
id- the unique identifier of the buslatitude- the latitude of the buslongitude- the longitude of the busheading- the heading of the bus in degreesroute- the route identifier the bus is servingdestination- the destination of the busdelayed- whether the bus is currently delayed
public record Bus(String id, BigDecimal latitude, BigDecimal longitude, Integer heading, String route, String destination, Boolean delayed)
extends Record
A bus currently in service.
-
Constructor Summary
ConstructorsConstructorDescriptionBus(String id, BigDecimal latitude, BigDecimal longitude, Integer heading, String route, String destination, Boolean delayed) Creates an instance of aBusrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondelayed()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.heading()Returns the value of theheadingrecord component.id()Returns the value of theidrecord component.latitude()Returns the value of thelatituderecord component.Returns the value of thelongituderecord 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, BigDecimal latitude, BigDecimal longitude, Integer heading, String route, String destination, Boolean delayed) Creates an instance of aBusrecord class.- Parameters:
id- the value for theidrecord componentlatitude- the value for thelatituderecord componentlongitude- the value for thelongituderecord componentheading- the value for theheadingrecord componentroute- the value for therouterecord componentdestination- the value for thedestinationrecord 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
-
latitude
Returns the value of thelatituderecord component.- Returns:
- the value of the
latituderecord component
-
longitude
Returns the value of thelongituderecord component.- Returns:
- the value of the
longituderecord component
-
heading
Returns the value of theheadingrecord component.- Returns:
- the value of the
headingrecord 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
-
delayed
Returns the value of thedelayedrecord component.- Returns:
- the value of the
delayedrecord component
-