Class Network

java.lang.Object
com.sanderjurgens.metroplanner.model.Network

public class Network extends Object
An overall network that contains and regulates all lines and stations. It also reads and imports a network from a file.
Author:
sanderjurgens
  • Constructor Details

    • Network

      public Network(URL url) throws IOException
      Constructs a network based on a file
      Parameters:
      url - the URL of the resource containing the network
      Throws:
      IOException - if an error occurs while reading the file
  • Method Details

    • getName

      public String getName()
      Returns the name of the network.
      Returns:
      the name of the network
    • getStationSet

      public StationSet getStationSet()
      Returns the set of all stations.
      Returns:
      the set of all stations
    • getLineSet

      public LineSet getLineSet()
      Returns the set of all lines.
      Returns:
      the set of all lines
    • getStation

      public Station getStation(String code)
      Returns the station with the given code.
      Parameters:
      code - a given code
      Returns:
      the station with the given code
    • getLine

      public Line getLine(String code)
      Returns the line with the given code.
      Parameters:
      code - a given code
      Returns:
      the line with the given code
    • toString

      public String toString()
      Returns a textual representation of this network.
      Overrides:
      toString in class Object
      Returns:
      a textual representation of this network