java.lang.Object
java.lang.Record
com.cta4j.train.model.UpcomingTrainArrival
- Record Components:
stationId- the unique identifier of the stationstopId- the unique identifier of the stopstationName- the name of the stationstopDescription- the description of the stoprun- the unique identifier of the train runroute- the route of the traindestinationStopId- the unique identifier of the destination stopdestinationName- the name of the destinationdirection- the direction of travel (0 = North, 1 = East, 2 = South, 3 = West)predictionTime- the time the prediction was madearrivalTime- the predicted arrival timeapproaching- whether the train is approaching the stationscheduled- whether the prediction is based on a scheduledelayed- whether the train is delayedfaulted- whether there is a fault affecting the trainflags- additional flags associated with the prediction
public record UpcomingTrainArrival(String stationId, String stopId, String stationName, String stopDescription, String run, Route route, String destinationStopId, String destinationName, Integer direction, Instant predictionTime, Instant arrivalTime, Boolean approaching, Boolean scheduled, Boolean delayed, Boolean faulted, String flags)
extends Record
An upcoming arrival prediction for a train at a station.
-
Constructor Summary
ConstructorsConstructorDescriptionUpcomingTrainArrival(String stationId, String stopId, String stationName, String stopDescription, String run, Route route, String destinationStopId, String destinationName, Integer direction, Instant predictionTime, Instant arrivalTime, Boolean approaching, Boolean scheduled, Boolean delayed, Boolean faulted, String flags) Creates an instance of aUpcomingTrainArrivalrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theapproachingrecord component.Returns the value of thearrivalTimerecord component.delayed()Returns the value of thedelayedrecord component.Returns the value of thedestinationNamerecord component.Returns the value of thedestinationStopIdrecord component.Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.longCalculates the estimated time of arrival (ETA) in minutes from the prediction time to the arrival time.faulted()Returns the value of thefaultedrecord component.flags()Returns the value of theflagsrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thepredictionTimerecord component.route()Returns the value of therouterecord component.run()Returns the value of therunrecord component.Returns the value of thescheduledrecord component.Returns the value of thestationIdrecord component.Returns the value of thestationNamerecord component.Returns the value of thestopDescriptionrecord component.stopId()Returns the value of thestopIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
UpcomingTrainArrival
public UpcomingTrainArrival(String stationId, String stopId, String stationName, String stopDescription, String run, Route route, String destinationStopId, String destinationName, Integer direction, Instant predictionTime, Instant arrivalTime, Boolean approaching, Boolean scheduled, Boolean delayed, Boolean faulted, String flags) Creates an instance of aUpcomingTrainArrivalrecord class.- Parameters:
stationId- the value for thestationIdrecord componentstopId- the value for thestopIdrecord componentstationName- the value for thestationNamerecord componentstopDescription- the value for thestopDescriptionrecord componentrun- the value for therunrecord componentroute- the value for therouterecord componentdestinationStopId- the value for thedestinationStopIdrecord componentdestinationName- the value for thedestinationNamerecord componentdirection- the value for thedirectionrecord componentpredictionTime- the value for thepredictionTimerecord componentarrivalTime- the value for thearrivalTimerecord componentapproaching- the value for theapproachingrecord componentscheduled- the value for thescheduledrecord componentdelayed- the value for thedelayedrecord componentfaulted- the value for thefaultedrecord componentflags- the value for theflagsrecord component
-
-
Method Details
-
etaMinutes
public long etaMinutes()Calculates the estimated time of arrival (ETA) in minutes from the prediction time to the arrival time. If the arrival time is before the prediction time, it returns 0.- Returns:
- the ETA in minutes, or 0 if the arrival time is before the prediction time.
-
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). -
stationId
Returns the value of thestationIdrecord component.- Returns:
- the value of the
stationIdrecord component
-
stopId
Returns the value of thestopIdrecord component.- Returns:
- the value of the
stopIdrecord component
-
stationName
Returns the value of thestationNamerecord component.- Returns:
- the value of the
stationNamerecord component
-
stopDescription
Returns the value of thestopDescriptionrecord component.- Returns:
- the value of the
stopDescriptionrecord component
-
run
Returns the value of therunrecord component.- Returns:
- the value of the
runrecord component
-
route
Returns the value of therouterecord component.- Returns:
- the value of the
routerecord component
-
destinationStopId
Returns the value of thedestinationStopIdrecord component.- Returns:
- the value of the
destinationStopIdrecord component
-
destinationName
Returns the value of thedestinationNamerecord component.- Returns:
- the value of the
destinationNamerecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
predictionTime
Returns the value of thepredictionTimerecord component.- Returns:
- the value of the
predictionTimerecord component
-
arrivalTime
Returns the value of thearrivalTimerecord component.- Returns:
- the value of the
arrivalTimerecord component
-
approaching
Returns the value of theapproachingrecord component.- Returns:
- the value of the
approachingrecord component
-
scheduled
Returns the value of thescheduledrecord component.- Returns:
- the value of the
scheduledrecord component
-
delayed
Returns the value of thedelayedrecord component.- Returns:
- the value of the
delayedrecord component
-
faulted
Returns the value of thefaultedrecord component.- Returns:
- the value of the
faultedrecord component
-
flags
Returns the value of theflagsrecord component.- Returns:
- the value of the
flagsrecord component
-