Class BusJourney

java.lang.Object
casa.lepton.walk.BusJourney

public class BusJourney extends Object
A bus journey along bus line paths, represented by an ordered list of paths between bus stops having each a start and end time.
  • Field Details

    • DATE_FORMAT

      public static final DateFormat DATE_FORMAT
      The date format of the stops times.
  • Constructor Details

    • BusJourney

      public BusJourney(org.graphstream.graph.Graph graph, String busName, List<org.graphstream.graph.Path> lines)
      Create an empty bus journey.
      Parameters:
      graph - the graph that hosts the nodes and edges of the bus paths
      busName - the name of the bus
      lines -
  • Method Details

    • getBusName

      public String getBusName()
      Give the name of the bus.
      Returns:
      the name of the bus
    • getStartTime

      public long getStartTime()
      Give the time when the bus leaves the first node of the journey.
      Returns:
      the start time of the bus journey
    • getEndTime

      public long getEndTime()
      Give the time when the bus arrives at the last node of the journey.
      Returns:
      the end time of the bus journey
    • iterator

      public Iterator<BusJourney.BusNode> iterator(long pauseSeed)
      Give an iterator over nodes that compose this journey.
      Parameters:
      pauseSeed - the seed used to create a random generator of pause durations
      Returns:
      iterator over nodes of this journey
    • iterator

      Give an iterator over nodes that compose this journey.
      Parameters:
      pauseGenerator - to generate pauses durations
      Returns:
      iterator over nodes of this journey
    • loadJourney

      public static BusJourney loadJourney(org.graphstream.graph.Graph graph, List<org.graphstream.graph.Path> lines, BufferedReader reader) throws IOException, ParseException
      Load a journey from an input stream which next line contains the name of the journey. After this method, the last line of the input stream is either null or an empty line.
      Parameters:
      graph - the graph that contains the nodes and edges of the lines
      lines - the paths representing the bus lines
      reader - input stream
      Returns:
      a bus journey or null if the next line of the reader is null or empty
      Throws:
      IOException - if an error occurs while reading the input stream
      ParseException - if a read line has a wrong format