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. @param busID Unique identifier of the bus @param busStop Coordinates of the bus stop @param nextPath The path to the next st
(int busID, Coord busStop, Path nextPath)
| 58 | * @param nextPath The path to the next stop |
| 59 | */ |
| 60 | public void busHasStopped(int busID, Coord busStop, Path nextPath) { |
| 61 | Iterator<BusTravellerMovement> iterator = travellers.values(). |
| 62 | iterator(); |
| 63 | while (iterator.hasNext()) { |
| 64 | BusTravellerMovement traveller = (BusTravellerMovement)iterator. |
| 65 | next(); |
| 66 | if (traveller.getLocation() != null) { |
| 67 | if ((traveller.getLocation()).equals(busStop)) { |
| 68 | if (traveller.getState() == BusTravellerMovement. |
| 69 | STATE_WAITING_FOR_BUS) { |
| 70 | Path path = new Path(nextPath); |
| 71 | traveller.enterBus(path); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Returns a reference to a BusControlSystem with ID provided as parameter. |