Package com.cta4j.train.location.model
Record Class LocationTrain
java.lang.Object
java.lang.Record
com.cta4j.train.location.model.LocationTrain
- Record Components:
run- the run number of this traindestinationStationId- the unique identifier of the destination station for this traindestinationName- the display name of the destination station for this traindirection- the direction of travel of this trainnextStationId- the unique identifier of the next station for this trainnextStopId- the unique identifier of the next stop for this trainnextStationName- the display name of the next station for this trainpredictionTime- the date and time (UTC) this location was generatedarrivalTime- the date and time (UTC) of this train's arrival at the next stopapproaching- whether this train is currently approaching the next stopdelayed- whether this train is currently delayedflags- the flags associated with this train, if applicablecoordinates- the current coordinates of this train
@NullMarked
public record LocationTrain(String run, String destinationStationId, String destinationName, TrainDirection direction, String nextStationId, String nextStopId, String nextStationName, Instant predictionTime, Instant arrivalTime, boolean approaching, boolean delayed, @Nullable String flags, Coordinates coordinates)
extends Record
Represents the location of a train on a route.
-
Constructor Summary
ConstructorsConstructorDescriptionLocationTrain(String run, String destinationStationId, String destinationName, TrainDirection direction, String nextStationId, String nextStopId, String nextStationName, Instant predictionTime, Instant arrivalTime, boolean approaching, boolean delayed, @Nullable String flags, Coordinates coordinates) Constructs aLocationTrain. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theapproachingrecord component.Returns the value of thearrivalTimerecord component.Returns the value of thecoordinatesrecord component.booleandelayed()Returns the value of thedelayedrecord component.Returns the value of thedestinationNamerecord component.Returns the value of thedestinationStationIdrecord component.Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.@Nullable Stringflags()Returns the value of theflagsrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thenextStationIdrecord component.Returns the value of thenextStationNamerecord component.Returns the value of thenextStopIdrecord component.Returns the value of thepredictionTimerecord component.run()Returns the value of therunrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LocationTrain
public LocationTrain(String run, String destinationStationId, String destinationName, TrainDirection direction, String nextStationId, String nextStopId, String nextStationName, Instant predictionTime, Instant arrivalTime, boolean approaching, boolean delayed, @Nullable String flags, Coordinates coordinates) Constructs aLocationTrain.- Parameters:
run- the run number of the traindestinationStationId- the unique identifier of the destination station for the traindestinationName- the display name of the destination station for the traindirection- the direction of travel of the trainnextStationId- the unique identifier of the next station for the trainnextStopId- the unique identifier of the next stop for the trainnextStationName- the display name of the next station for the trainpredictionTime- the date and time (UTC) the location was generatedarrivalTime- the date and time (UTC) of the train's arrival at the next stopapproaching- whether the train is currently approaching the next stopdelayed- whether the train is currently delayedflags- the flags associated with the train, if applicablecoordinates- the current coordinates of the train- Throws:
NullPointerException- ifrun,destinationStationId,destinationName,direction,nextStationId,nextStopId,nextStationName,predictionTime,arrivalTime, orcoordinatesarenull
-
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
run
Returns the value of therunrecord component.- Returns:
- the value of the
runrecord component
-
destinationStationId
Returns the value of thedestinationStationIdrecord component.- Returns:
- the value of the
destinationStationIdrecord 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
-
nextStationId
Returns the value of thenextStationIdrecord component.- Returns:
- the value of the
nextStationIdrecord component
-
nextStopId
Returns the value of thenextStopIdrecord component.- Returns:
- the value of the
nextStopIdrecord component
-
nextStationName
Returns the value of thenextStationNamerecord component.- Returns:
- the value of the
nextStationNamerecord 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
public boolean approaching()Returns the value of theapproachingrecord component.- Returns:
- the value of the
approachingrecord component
-
delayed
public boolean delayed()Returns the value of thedelayedrecord component.- Returns:
- the value of the
delayedrecord component
-
flags
Returns the value of theflagsrecord component.- Returns:
- the value of the
flagsrecord component
-
coordinates
Returns the value of thecoordinatesrecord component.- Returns:
- the value of the
coordinatesrecord component
-