Package com.cta4j.train.location.model
Record Class TrainLocations
java.lang.Object
java.lang.Record
com.cta4j.train.location.model.TrainLocations
- Record Components:
line- the train line associated with these locationstrains- theListofLocationTrains for this train line
Represents the locations of all trains on a route.
-
Constructor Summary
ConstructorsConstructorDescriptionTrainLocations(TrainLine line, List<LocationTrain> trains) Constructs aTrainLocations. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.line()Returns the value of thelinerecord component.final StringtoString()Returns a string representation of this record class.trains()Returns the value of thetrainsrecord component.
-
Constructor Details
-
TrainLocations
Constructs aTrainLocations.- Parameters:
line- the train line associated with the locationstrains- theListofLocationTrains for the train line- Throws:
NullPointerException- iflineortrainsisnull, or iftrainscontainsnullelements
-
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
line
Returns the value of thelinerecord component.- Returns:
- the value of the
linerecord component
-
trains
Returns the value of thetrainsrecord component.- Returns:
- the value of the
trainsrecord component
-