java.lang.Object
java.lang.Record
com.cta4j.bus.model.StopArrival
- Record Components:
predictionType- the type of prediction (arrival or departure)stopName- the name of the bus stopstopId- the unique identifier of the bus stopvehicleId- the unique identifier of the bus vehicledistanceToStop- the distance from the bus to the stop in feetroute- the bus route identifierrouteDesignator- additional designator for the route, if anyrouteDirection- the direction of the bus route (e.g., Northbound, Southbound)destination- the final destination of the busarrivalTime- the predicted arrival time at the stopdelayed- indicates whether the bus is delayed
public record StopArrival(BusPredictionType predictionType, String stopName, String stopId, String vehicleId, BigInteger distanceToStop, String route, String routeDesignator, String routeDirection, String destination, Instant arrivalTime, Boolean delayed)
extends Record
An arrival prediction for a bus at a specific stop.
-
Constructor Summary
ConstructorsConstructorDescriptionStopArrival(BusPredictionType predictionType, String stopName, String stopId, String vehicleId, BigInteger distanceToStop, String route, String routeDesignator, String routeDirection, String destination, Instant arrivalTime, Boolean delayed) Creates an instance of aStopArrivalrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thearrivalTimerecord component.delayed()Returns the value of thedelayedrecord component.Returns the value of thedestinationrecord component.Returns the value of thedistanceToStoprecord component.final booleanIndicates whether some other object is "equal to" this one.Calculates the estimated time of arrival (ETA) in minutes from the current time to the predicted arrival time.final inthashCode()Returns a hash code value for this object.Returns the value of thepredictionTyperecord component.route()Returns the value of therouterecord component.Returns the value of therouteDesignatorrecord component.Returns the value of therouteDirectionrecord component.stopId()Returns the value of thestopIdrecord component.stopName()Returns the value of thestopNamerecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevehicleIdrecord component.
-
Constructor Details
-
StopArrival
public StopArrival(BusPredictionType predictionType, String stopName, String stopId, String vehicleId, BigInteger distanceToStop, String route, String routeDesignator, String routeDirection, String destination, Instant arrivalTime, Boolean delayed) Creates an instance of aStopArrivalrecord class.- Parameters:
predictionType- the value for thepredictionTyperecord componentstopName- the value for thestopNamerecord componentstopId- the value for thestopIdrecord componentvehicleId- the value for thevehicleIdrecord componentdistanceToStop- the value for thedistanceToStoprecord componentroute- the value for therouterecord componentrouteDesignator- the value for therouteDesignatorrecord componentrouteDirection- the value for therouteDirectionrecord componentdestination- the value for thedestinationrecord componentarrivalTime- the value for thearrivalTimerecord componentdelayed- the value for thedelayedrecord component
-
-
Method Details
-
etaMinutes
Calculates the estimated time of arrival (ETA) in minutes from the current time to the predicted arrival time. If the arrival time is in the past, it returns 0.- Returns:
- the ETA in minutes, or 0 if the arrival time is in the past
-
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). -
predictionType
Returns the value of thepredictionTyperecord component.- Returns:
- the value of the
predictionTyperecord component
-
stopName
Returns the value of thestopNamerecord component.- Returns:
- the value of the
stopNamerecord component
-
stopId
Returns the value of thestopIdrecord component.- Returns:
- the value of the
stopIdrecord component
-
vehicleId
Returns the value of thevehicleIdrecord component.- Returns:
- the value of the
vehicleIdrecord component
-
distanceToStop
Returns the value of thedistanceToStoprecord component.- Returns:
- the value of the
distanceToStoprecord component
-
route
Returns the value of therouterecord component.- Returns:
- the value of the
routerecord component
-
routeDesignator
Returns the value of therouteDesignatorrecord component.- Returns:
- the value of the
routeDesignatorrecord component
-
routeDirection
Returns the value of therouteDirectionrecord component.- Returns:
- the value of the
routeDirectionrecord component
-
destination
Returns the value of thedestinationrecord component.- Returns:
- the value of the
destinationrecord component
-
arrivalTime
Returns the value of thearrivalTimerecord component.- Returns:
- the value of the
arrivalTimerecord component
-
delayed
Returns the value of thedelayedrecord component.- Returns:
- the value of the
delayedrecord component
-