movement
Class BusControlSystem

java.lang.Object
  extended by movement.BusControlSystem

public class BusControlSystem
extends java.lang.Object

This class controls busses and passengers that can use the bus. There can be many bus BusControlSystems, but a bus or passenger can only belong to one system.


Field Summary
static java.lang.String BUS_CONTROL_SYSTEM_NR
           
 
Method Summary
 void busHasStopped(int busID, Coord busStop, Path nextPath)
          Called by busses belonging to this system every time the bus has stopped.
static BusControlSystem getBusControlSystem(int systemID)
          Returns a reference to a BusControlSystem with ID provided as parameter.
 java.util.List<Coord> getBusStops()
           
 SimMap getMap()
          Get the underlying map of the system
 void registerBus(BusMovement bus)
          Registers a bus to be part of a bus control system
 void registerTraveller(BusTravellerMovement traveller)
          Registers a traveller/passenger to be part of a bus control system
static void reset()
           
 void setBusStops(java.util.List<Coord> busStops)
          Set the bus stops that belong to this system
 void setMap(SimMap map)
          Provide the system with the map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUS_CONTROL_SYSTEM_NR

public static final java.lang.String BUS_CONTROL_SYSTEM_NR
See Also:
Constant Field Values
Method Detail

reset

public static void reset()

busHasStopped

public void busHasStopped(int busID,
                          Coord busStop,
                          Path nextPath)
Called by busses belonging to this system every time the bus has stopped. It calls every passengers enterBus() method so that the passengers can enter the bus if they want to.

Parameters:
busID - Unique identifier of the bus
busStop - Coordinates of the bus stop
nextPath - The path to the next stop

getBusControlSystem

public static BusControlSystem getBusControlSystem(int systemID)
Returns a reference to a BusControlSystem with ID provided as parameter. If a system does not already exist with the requested ID, a new one is created.

Parameters:
systemID - unique ID of the system
Returns:
The bus control system with the provided ID

registerBus

public void registerBus(BusMovement bus)
Registers a bus to be part of a bus control system

Parameters:
bus - The bus to register

registerTraveller

public void registerTraveller(BusTravellerMovement traveller)
Registers a traveller/passenger to be part of a bus control system

Parameters:
traveller - The traveller to register

setMap

public void setMap(SimMap map)
Provide the system with the map

Parameters:
map -

getMap

public SimMap getMap()
Get the underlying map of the system

Returns:
The map

getBusStops

public java.util.List<Coord> getBusStops()
Returns:
A list of all bus stops belonging to this system

setBusStops

public void setBusStops(java.util.List<Coord> busStops)
Set the bus stops that belong to this system

Parameters:
busStops -