java.lang.Object
org.opentrafficsim.core.network.route.Route
org.opentrafficsim.road.gtu.lane.tactical.pt.BusSchedule
All Implemented Interfaces:
Identifiable

public class BusSchedule extends Route

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • BusSchedule

      public BusSchedule(String id, GtuType gtuType, List<Node> nodes, String line) throws NetworkException
      Constructor.
      Parameters:
      id - id
      gtuType - the GtuType for which this is a route
      nodes - nodes
      line - line of the bus schedule
      Throws:
      NetworkException - if intermediate nodes are missing in the route.
    • BusSchedule

      public BusSchedule(String id, GtuType gtuType, String line)
      Constructor.
      Parameters:
      id - id
      gtuType - the GtuType for which this is a route
      line - line of the bus schedule
  • Method Details

    • addBusStop

      public void addBusStop(String busStopId, Duration departureTime, Duration dwellTime, boolean forceSchedule)
      Adds a stop to the schedule.
      Parameters:
      busStopId - bus stop id
      departureTime - departure time
      dwellTime - dwell time
      forceSchedule - whether to wait until departure time
    • isLineStop

      public boolean isLineStop(String busStopId, Duration time)
      Whether the bus of this line should stop for this bus stop. False if not the correct line, or already stopped.
      Parameters:
      busStopId - id of bus stop
      time - time to check
      Returns:
      whether the bus of this line should stop for this bus stop
    • getDepartureTime

      public Duration getDepartureTime(String busStopId)
      Returns departure time for the given bus stop.
      Parameters:
      busStopId - id of bus stop
      Returns:
      departure time for the given bus stop
    • getDwellTime

      public Duration getDwellTime(String busStopId)
      Returns dwell time for the given bus stop.
      Parameters:
      busStopId - id of bus stop
      Returns:
      dwell time for the given bus stop
    • isForceSchedule

      public boolean isForceSchedule(String busStopId)
      Returns whether the departure time is enforced.
      Parameters:
      busStopId - id of bus stop
      Returns:
      whether the departure time is enforced
    • setActualDeparture

      public void setActualDeparture(String busStopId, Set<String> conflictIds, Duration time)
      Set actual departure time.
      Parameters:
      busStopId - bus stop id
      conflictIds - conflicts downstream of the bus stop
      time - actual departure time
    • getActualDepartureBusStop

      public Optional<Duration> getActualDepartureBusStop(String busStopId)
      Return the actual departure time.
      Parameters:
      busStopId - bus stop id
      Returns:
      actual departure time, empty if not given
    • getActualDepartureConflict

      public Optional<Duration> getActualDepartureConflict(String conflictId)
      Return the actual departure time.
      Parameters:
      conflictId - conflict id
      Returns:
      actual departure time, empty if not given
    • getLine

      public String getLine()
      Return bus line.
      Returns:
      line.
    • toString

      public String toString()
      Overrides:
      toString in class Route