Class Stop

java.lang.Object
id.klacak.bus_navigator.Stop

public class Stop extends Object
A transit stop and the routes that serve it.
  • Constructor Details

    • Stop

      public Stop(String name)
      Creates a stop with the given name.
      Parameters:
      name - stop name
  • Method Details

    • getName

      public String getName()
      Gets the name of this stop.
      Returns:
      the stop name
    • getNameFormatted

      public String getNameFormatted()
      Formats the stop name followed by colored codes for its serving routes.
      Returns:
      formatted stop name and route codes
    • getRoutes

      public List<Route> getRoutes()
      Gets the routes that serve this stop.
      Returns:
      the mutable list of serving routes
    • addRoute

      public void addRoute(Route newRoute)
      Adds a serving route if it is not already present.
      Parameters:
      newRoute - route to associate with this stop
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      a text description of this stop and its serving routes