@Override public void startRoute(final Route route, final BufferedWriter out) throws IOException { out.write("\t\t\t\t<route>"); if (route instanceof NetworkRoute) { for (Node n : RouteUtils.getNodes((NetworkRoute) route, this.network)) { out.write(n.getId() + " "); } } else { out.write(route.getRouteDescription()); } }
String rd = route.getRouteDescription(); if (rd != null) { out.write(rd);
public GenericRouteSerializable(Route route) { distance = route.getDistance(); endLinkIdString = route.getEndLinkId().toString(); routeDescription = route.getRouteDescription(); startLinkIdString = route.getStartLinkId().toString(); travelTime = route.getTravelTime(); }
String rd = route.getRouteDescription(); if (rd != null) { out.write(rd);
@Override public void startRoute(final Route route, final BufferedWriter out) throws IOException { out.write("\t\t\t\t<route"); if (!Double.isNaN(route.getDistance())) { out.write(" dist=\""); out.write(Double.toString(route.getDistance())); out.write("\""); } if (route.getTravelTime() != Time.UNDEFINED_TIME) { out.write(" trav_time=\""); out.write(Time.writeTime(route.getTravelTime())); out.write("\""); } out.write(">\n"); out.write("\t\t\t\t\t"); if (route instanceof NetworkRoute) { for (Node n : RouteUtils.getNodes((NetworkRoute) route, this.network)) { out.write(n.getId().toString()); out.write(" "); } } else { String rd = route.getRouteDescription(); if (rd != null) { out.write(rd); out.write(" "); // this is at the moment only to maintain binary compatibility } } out.write("\n"); }
@Override public Id<TransitStopFacility> getDesiredDestinationStopId() { Leg leg = getCurrentLeg(); if (!(leg.getRoute() instanceof ExperimentalTransitRoute)) { log.error("pt-leg has no TransitRoute. Removing agent from simulation. Agent " + getId().toString()); log.info("route: " + leg.getRoute().getClass().getCanonicalName() + " " + leg.getRoute().getRouteDescription()); return null; } else { ExperimentalTransitRoute route = (ExperimentalTransitRoute) leg.getRoute(); return route.getEgressStopId(); } }
@Override public final Id<TransitStopFacility> getDesiredAccessStopId() { Leg leg = basicAgentDelegate.getCurrentLeg(); if (!(leg.getRoute() instanceof ExperimentalTransitRoute)) { log.error("pt-leg has no TransitRoute. Removing agent from simulation. Agent " + getId().toString()); log.info("route: " + leg.getRoute().getClass().getCanonicalName() + " " + leg.getRoute().getRouteDescription()); return null; } else { ExperimentalTransitRoute route = (ExperimentalTransitRoute) leg.getRoute(); Id<TransitStopFacility> accessStopId = route.getAccessStopId(); return accessStopId; } }
@Override public Id<TransitStopFacility> getDesiredAccessStopId() { Leg leg = getCurrentLeg(); if (!(leg.getRoute() instanceof ExperimentalTransitRoute)) { log.error("pt-leg has no TransitRoute. Removing agent from simulation. Agent " + getId().toString()); log.info("route: " + leg.getRoute().getClass().getCanonicalName() + " " + leg.getRoute().getRouteDescription()); return null; } else { ExperimentalTransitRoute route = (ExperimentalTransitRoute) leg.getRoute(); return route.getAccessStopId(); } }
if (route.getRouteDescription() != null) { if (route.getRouteDescription().contains(this.pIdentifier)) {
@Override public void handleEvent(PersonEntersVehicleEvent event) { Double startWaitingTime = agentsWaitingData.get(event.getPersonId()); if(startWaitingTime!=null) { int legs = 0, currentLeg = agentsCurrentLeg.get(event.getPersonId()); PLAN_ELEMENTS: for(PlanElement planElement:population.getPersons().get(event.getPersonId()).getSelectedPlan().getPlanElements()) if(planElement instanceof Leg) { if(currentLeg==legs) { Route route = (((Leg)planElement).getRoute()); ExperimentalTransitRoute eRoute = (ExperimentalTransitRoute) new ExperimentalTransitRouteFactory().createRoute(route.getStartLinkId(), route.getEndLinkId()); eRoute.setStartLinkId(route.getStartLinkId()); eRoute.setEndLinkId(route.getEndLinkId()); eRoute.setRouteDescription(route.getRouteDescription()); WaitTimeData data = waitTimes.get(new Tuple<Id<TransitLine>, Id<TransitRoute>>(eRoute.getLineId(), eRoute.getRouteId())).get(eRoute.getAccessStopId()); data.addWaitTime((int) (startWaitingTime/timeSlot), event.getTime()-startWaitingTime); agentsWaitingData.remove(event.getPersonId()); break PLAN_ELEMENTS; } else legs++; } } }
@Override public void handleEvent(PersonStuckEvent event) { Double startWaitingTime = agentsWaitingData.get(event.getPersonId()); if(startWaitingTime!=null) { int legs = 0, currentLeg = agentsCurrentLeg.get(event.getPersonId()); PLAN_ELEMENTS: for(PlanElement planElement:population.getPersons().get(event.getPersonId()).getSelectedPlan().getPlanElements()) if(planElement instanceof Leg) { if(currentLeg==legs) { Route route = ((Leg)planElement).getRoute(); ExperimentalTransitRoute eRoute = (ExperimentalTransitRoute) new ExperimentalTransitRouteFactory().createRoute(route.getStartLinkId(), route.getEndLinkId()); eRoute.setStartLinkId(route.getStartLinkId()); eRoute.setEndLinkId(route.getEndLinkId()); eRoute.setRouteDescription(route.getRouteDescription()); WaitTimeData data = waitTimes.get(new Tuple<Id<TransitLine>, Id<TransitRoute>>(eRoute.getLineId(), eRoute.getRouteId())).get(eRoute.getAccessStopId()); if(data!=null) data.addWaitTime((int) (startWaitingTime/timeSlot), event.getTime()-startWaitingTime); agentsWaitingData.remove(event.getPersonId()); break PLAN_ELEMENTS; } else legs++; } } }