Record Class RoutePattern

java.lang.Object
java.lang.Record
com.cta4j.bus.pattern.model.RoutePattern
Record Components:
id - the unique identifier of this route pattern
length - the length of this route pattern in feet
direction - the direction of this route pattern (e.g., "Northbound", "Southbound")
points - the List of pattern points that make up this route pattern
detourId - the identifier of the detour associated with this route pattern, if applicable
detourPoints - the List of pattern points of the detour associated with this route pattern, if applicable

@NullMarked public record RoutePattern(String id, int length, String direction, List<PatternPoint> points, @Nullable String detourId, @Nullable List<PatternPoint> detourPoints) extends Record
Represents a bus route pattern.
  • Constructor Details

    • RoutePattern

      public RoutePattern(String id, int length, String direction, List<PatternPoint> points, @Nullable String detourId, @Nullable List<PatternPoint> detourPoints)
      Constructs a RoutePattern.
      Parameters:
      id - the unique identifier of the route pattern
      length - the length of the route pattern in feet
      direction - the direction of the route pattern (e.g., "Northbound", "Southbound")
      points - the List of pattern points that make up the route pattern
      detourId - the identifier of the detour associated with the route pattern, if applicable
      detourPoints - the List of pattern points of the detour associated with the route pattern, if applicable
      Throws:
      NullPointerException - if id, direction, or points is null, or if any element of points or detourPoints 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • length

      public int length()
      Returns the value of the length record component.
      Returns:
      the value of the length record component
    • direction

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

      public List<PatternPoint> points()
      Returns the value of the points record component.
      Returns:
      the value of the points record component
    • detourId

      public @Nullable String detourId()
      Returns the value of the detourId record component.
      Returns:
      the value of the detourId record component
    • detourPoints

      public @Nullable List<PatternPoint> detourPoints()
      Returns the value of the detourPoints record component.
      Returns:
      the value of the detourPoints record component