@Override
  public void handleEvent(LinkLeaveEvent event) {
    try {
      if (ptVehicles.keySet().contains(event.getVehicleId())) {
        PTVehicle vehicle = ptVehicles.get(event.getVehicleId());
        if (vehicle.in) vehicle.in = false;
        vehicle.incDistance(network.getLinks().get(event.getLinkId()).getLength());

      } else {
        TravellerChain chain = chains.get(driverIdFromVehicleId.get(event.getVehicleId()));
        if (chain.inCar) {
          Journey journey = chain.getJourneys().getLast();
          journey.incrementCarDistance(network.getLinks().get(event.getLinkId()).getLength());
        }
      }
    } catch (Exception e) {
      System.err.println(e.getStackTrace());
      System.err.println(event.toString());
    }
  }
예제 #2
0
 @Override
 public void handleEvent(final LinkLeaveEvent event) {
   if (ignoreLinkEvents) return;
   handleEvent(eventsPerPerson, event.getDriverId(), event);
 }