Record Class Station

java.lang.Object
java.lang.Record
com.cta4j.train.station.model.Station
Record Components:
stopId - the unique stop identifier of this station
direction - the CardinalDirection of this station
stopName - the stop name of this station
name - the name of this station
descriptiveName - the descriptive name of this station
mapId - the map identifier of this station
adaAccessible - whether this station is ADA accessible
lines - the List of TrainLines that serve this station
location - the Location of this station

@NullMarked public record Station(String stopId, CardinalDirection direction, String stopName, String name, String descriptiveName, String mapId, boolean adaAccessible, List<TrainLine> lines, Location location) extends Record
Represents a train station.
  • Constructor Details

    • Station

      public Station(String stopId, CardinalDirection direction, String stopName, String name, String descriptiveName, String mapId, boolean adaAccessible, List<TrainLine> lines, Location location)
      Constructs a Station.
      Parameters:
      stopId - the unique stop identifier of the station
      direction - the CardinalDirection of the station
      stopName - the stop name of the station
      name - the name of the station
      descriptiveName - the descriptive name of the station
      mapId - the map identifier of the station
      adaAccessible - whether the station is ADA accessible
      lines - the List of TrainLines that serve the station
      location - the Location of the station
      Throws:
      NullPointerException - if stopId, direction, stopName, name, descriptiveName, mapId, lines, or location is null, or if any element of lines is null
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • stopId

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

      public CardinalDirection direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • stopName

      public String stopName()
      Returns the value of the stopName record component.
      Returns:
      the value of the stopName record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • descriptiveName

      public String descriptiveName()
      Returns the value of the descriptiveName record component.
      Returns:
      the value of the descriptiveName record component
    • mapId

      public String mapId()
      Returns the value of the mapId record component.
      Returns:
      the value of the mapId record component
    • adaAccessible

      public boolean adaAccessible()
      Returns the value of the adaAccessible record component.
      Returns:
      the value of the adaAccessible record component
    • lines

      public List<TrainLine> lines()
      Returns the value of the lines record component.
      Returns:
      the value of the lines record component
    • location

      public Location location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component