Enum Class TrainLine

java.lang.Object
java.lang.Enum<TrainLine>
com.cta4j.train.common.model.TrainLine
All Implemented Interfaces:
Serializable, Comparable<TrainLine>, Constable

@NullMarked public enum TrainLine extends Enum<TrainLine>
Represents a train line.
  • Enum Constant Details

    • RED

      public static final TrainLine RED
      The Red Line.
    • BLUE

      public static final TrainLine BLUE
      The Blue Line.
    • BROWN

      public static final TrainLine BROWN
      The Brown Line.
    • GREEN

      public static final TrainLine GREEN
      The Green Line.
    • ORANGE

      public static final TrainLine ORANGE
      The Orange Line.
    • PURPLE

      public static final TrainLine PURPLE
      The Purple Line.
    • PINK

      public static final TrainLine PINK
      The Pink Line.
    • YELLOW

      public static final TrainLine YELLOW
      The Yellow Line.
  • Method Details

    • values

      public static TrainLine[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TrainLine valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public String getCode()
      Gets the CTA code for this train line.
      Returns:
      the CTA code
    • getColorHex

      public String getColorHex()
      Gets the hex color code of this train line.
      Returns:
      the hex color code
    • fromCode

      public static TrainLine fromCode(String code)
      Returns the TrainLine corresponding to the given code.
      Parameters:
      code - the CTA code of the train line (case-insensitive, may include "LINE" suffix)
      Returns:
      the corresponding TrainLine
      Throws:
      IllegalArgumentException - if the code does not correspond to any known train line