Record Class TrainLocation
java.lang.Object
java.lang.Record
com.cta4j.model.train.TrainLocation
- Record Components:
coordinates- the coordinates and heading of the trainarrivals- the list of upcoming train arrivals for the train
public record TrainLocation(TrainCoordinates coordinates, List<UpcomingTrainArrival> arrivals)
extends Record
The location of a train along with its upcoming arrivals.
-
Constructor Summary
ConstructorsConstructorDescriptionTrainLocation(TrainCoordinates coordinates, List<UpcomingTrainArrival> arrivals) Creates an instance of aTrainLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionarrivals()Returns the value of thearrivalsrecord component.Returns the value of thecoordinatesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TrainLocation
Creates an instance of aTrainLocationrecord class.- Parameters:
coordinates- the value for thecoordinatesrecord componentarrivals- the value for thearrivalsrecord 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. All components in this record class are compared withObjects::equals(Object,Object). -
coordinates
Returns the value of thecoordinatesrecord component.- Returns:
- the value of the
coordinatesrecord component
-
arrivals
-