Esempio n. 1
0
 @Override
 public void handleEvent(PersonEntersVehicleEvent event) {
   if (pIdsToExclude.contains(event.getPersonId())) {
     return;
   }
   if (!event.getPersonId().toString().startsWith("pt_tr"))
     if (event.getVehicleId().toString().startsWith("tr")) {
       TravellerChain chain = chains.get(event.getPersonId());
       chain.lineId = ptVehicles.get(event.getVehicleId()).lineId;
       chain.routeId = ptVehicles.get(event.getVehicleId()).routeId;
     }
 }
Esempio n. 2
0
 @Override
 public void handleEvent(PersonDepartureEvent event) {
   if (pIdsToExclude.contains(event.getPersonId())) {
     return;
   }
   TravellerChain chain = chains.get(event.getPersonId());
   if (chain == null) {
     chain = new TravellerChain();
     chains.put(event.getPersonId(), chain);
   }
   chain.lastTime = event.getTime();
   if (event.getLegMode().equals("transit_walk")) chain.walk = true;
   else chain.walk = false;
 }
Esempio n. 3
0
 @Override
 public void handleEvent(ActivityStartEvent event) {
   if (pIdsToExclude.contains(event.getPersonId())) {
     return;
   }
   TravellerChain chain = chains.get(event.getPersonId());
   boolean beforeInPT = chain.inPT;
   if (event.getActType().equals(PtConstants.TRANSIT_ACTIVITY_TYPE)) chain.inPT = true;
   else chain.inPT = false;
   if (!chain.inPT && !chain.walk) chain.modes.add("car");
   else if (!chain.inPT && chain.walk && !beforeInPT) chain.modes.add("walk");
   else if (chain.walk) chain.modes.add("transit_walk");
   else
     chain.modes.add(
         getMode(
             transitSchedule
                 .getTransitLines()
                 .get(chain.lineId)
                 .getRoutes()
                 .get(chain.routeId)
                 .getTransportMode(),
             chain.lineId));
   chain.times.add(event.getTime() - chain.lastTime);
 }