/** * We create a new Plan which contains only the Leg that should be replanned and its previous and next * Activities. By doing so the PlanAlgorithm will only change the Route of that Leg. * * Use currentNodeIndex from a DriverAgent if possible! * * Otherwise code it as following: * startLink - Node1 - routeLink1 - Node2 - routeLink2 - Node3 - endLink * The currentNodeIndex has to Point to the next Node * (which is the endNode of the current Link) */ public boolean replanCurrentLegRoute(Leg leg, Person person, int currentLinkIndex, double time ) { // just a pointer to that other method, but this one (which does not change the destination) is still ok also with access/egress // routing Route route = leg.getRoute(); // if the route type is not supported: if (!(route instanceof NetworkRoute)) { log.warn( "route not instance of NetworkRoute"); return false; } // (cannot move the above test down into relocateCurrentLegRoute, since it also hedges against route==null. kai, nov'17) return relocateCurrentLegRoute(leg, person, currentLinkIndex, route.getEndLinkId(), time ); }