コード例 #1
0
 @Override
 public void handleEvent(TeleportationArrivalEvent event) {
   try {
     if (transitDriverIds.contains(event.getPersonId())) return;
     TravellerChain chain = chains.get(event.getPersonId());
     if (chain.traveledVehicle) chain.traveledVehicle = false;
   } catch (Exception e) {
     System.err.println(e.getStackTrace());
     System.err.println(event.toString());
   }
 }
コード例 #2
0
  @Override
  public void handleEvent(PersonLeavesVehicleEvent event) {
    if (transitDriverIds.contains(event.getPersonId())) return;
    try {
      if (ptVehicles.keySet().contains(event.getVehicleId())) {
        TravellerChain chain = chains.get(event.getPersonId());
        chain.traveledVehicle = true;
        PTVehicle vehicle = ptVehicles.get(event.getVehicleId());
        double stageDistance = vehicle.removePassenger(event.getPersonId());
        Trip trip = chain.getJourneys().getLast().getTrips().getLast();
        trip.setDistance(stageDistance);
        trip.setAlightingStop(vehicle.lastStop);
      } else {
        driverIdFromVehicleId.remove(event.getVehicleId());
      }

    } catch (Exception e) {
      System.err.println(e.getStackTrace());
      System.err.println(event.toString());
    }
  }