Record Class Bus
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, int heading, String route, String destination, boolean delayed)
extends Record
A bus currently in service.
-
Constructor Summary
ConstructorsConstructorDescriptionBus(String id, BigDecimal latitude, BigDecimal longitude, int heading, String route, String destination, boolean delayed) Creates an instance of aBusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleandelayed()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.intheading()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, int 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
-
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. -
id
-
latitude
-
longitude
-
heading
-
route
-
destination
Returns the value of thedestinationrecord component.- Returns:
- the value of the
destinationrecord component
-
delayed
-