Record Class StationArrival

java.lang.Object
java.lang.Record
com.cta4j.train.model.StationArrival
Record Components:
stationId - the unique identifier of the station
stopId - the unique identifier of the stop
stationName - the name of the station
stopDescription - the description of the stop
run - the unique identifier of the train run
route - the route of the train
destinationStopId - the unique identifier of the destination stop
destinationName - the name of the destination
direction - the direction of travel (0 = North, 1 = East, 2 = South, 3 = West)
predictionTime - the time the prediction was made
arrivalTime - the predicted arrival time
approaching - whether the train is approaching the station
scheduled - whether the prediction is based on a schedule
delayed - whether the train is delayed
faulted - whether there is a fault affecting the train
flags - additional flags associated with the prediction
latitude - the latitude of the train's current location
longitude - the longitude of the train's current location
heading - the heading of the train in degrees (0-359)

public record StationArrival(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, BigDecimal latitude, BigDecimal longitude, Integer heading) extends Record
An arrival prediction for a train at a station.
  • Constructor Details

    • StationArrival

      public StationArrival(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, BigDecimal latitude, BigDecimal longitude, Integer heading)
      Creates an instance of a StationArrival record class.
      Parameters:
      stationId - the value for the stationId record component
      stopId - the value for the stopId record component
      stationName - the value for the stationName record component
      stopDescription - the value for the stopDescription record component
      run - the value for the run record component
      route - the value for the route record component
      destinationStopId - the value for the destinationStopId record component
      destinationName - the value for the destinationName record component
      direction - the value for the direction record component
      predictionTime - the value for the predictionTime record component
      arrivalTime - the value for the arrivalTime record component
      approaching - the value for the approaching record component
      scheduled - the value for the scheduled record component
      delayed - the value for the delayed record component
      faulted - the value for the faulted record component
      flags - the value for the flags record component
      latitude - the value for the latitude record component
      longitude - the value for the longitude record component
      heading - the value for the heading record 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • stationId

      public String stationId()
      Returns the value of the stationId record component.
      Returns:
      the value of the stationId record component
    • stopId

      public String stopId()
      Returns the value of the stopId record component.
      Returns:
      the value of the stopId record component
    • stationName

      public String stationName()
      Returns the value of the stationName record component.
      Returns:
      the value of the stationName record component
    • stopDescription

      public String stopDescription()
      Returns the value of the stopDescription record component.
      Returns:
      the value of the stopDescription record component
    • run

      public String run()
      Returns the value of the run record component.
      Returns:
      the value of the run record component
    • route

      public Route route()
      Returns the value of the route record component.
      Returns:
      the value of the route record component
    • destinationStopId

      public String destinationStopId()
      Returns the value of the destinationStopId record component.
      Returns:
      the value of the destinationStopId record component
    • destinationName

      public String destinationName()
      Returns the value of the destinationName record component.
      Returns:
      the value of the destinationName record component
    • direction

      public Integer direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • predictionTime

      public Instant predictionTime()
      Returns the value of the predictionTime record component.
      Returns:
      the value of the predictionTime record component
    • arrivalTime

      public Instant arrivalTime()
      Returns the value of the arrivalTime record component.
      Returns:
      the value of the arrivalTime record component
    • approaching

      public Boolean approaching()
      Returns the value of the approaching record component.
      Returns:
      the value of the approaching record component
    • scheduled

      public Boolean scheduled()
      Returns the value of the scheduled record component.
      Returns:
      the value of the scheduled record component
    • delayed

      public Boolean delayed()
      Returns the value of the delayed record component.
      Returns:
      the value of the delayed record component
    • faulted

      public Boolean faulted()
      Returns the value of the faulted record component.
      Returns:
      the value of the faulted record component
    • flags

      public String flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • latitude

      public BigDecimal latitude()
      Returns the value of the latitude record component.
      Returns:
      the value of the latitude record component
    • longitude

      public BigDecimal longitude()
      Returns the value of the longitude record component.
      Returns:
      the value of the longitude record component
    • heading

      public Integer heading()
      Returns the value of the heading record component.
      Returns:
      the value of the heading record component