/** * Convenience method, clarifying that this can be called without giving the mode. */ public void insertActivity(MobsimAgent agent, int index, Activity activity ) { String mode = tripRouter.getMainModeIdentifier().identifyMainMode( editTrips.findCurrentTrip(agent).getTripElements() ) ; insertActivity( agent, index, activity, mode, mode ) ; }
public final boolean replanCurrentTrip(MobsimAgent agent, double now, String routingMode ) { log.debug("entering replanCurrentTrip with routingMode=" + routingMode) ; // I will treat that in the way that it will make the trip consistent with the activities. So if the activity in the // plan has changed, the trip will go to a new location. // what matters is the external interface, which is the method call. Everything below is internal so it does not matter so much. Trip trip = findCurrentTrip( agent ) ; final PlanElement currentPlanElement = WithinDayAgentUtils.getCurrentPlanElement(agent) ; final List<PlanElement> tripElements = trip.getTripElements(); int tripElementsIndex = tripElements.indexOf( currentPlanElement ) ; // final String currentMode = tripRouter.getMainModeIdentifier().identifyMainMode( tripElements ) ; if ( currentPlanElement instanceof Activity ) { // we are on a stage activity. Take it from there: replanCurrentTripFromStageActivity(tripElements, tripElementsIndex, agent, routingMode); } else { // we are on a leg replanCurrentTripFromLeg(trip.getDestinationActivity(), currentPlanElement, routingMode, now, agent); } WithinDayAgentUtils.resetCaches(agent); return true ; } private void replanCurrentTripFromLeg(Activity newAct, final PlanElement currentPlanElement, final String routingMode,
public String getModeOfCurrentOrNextTrip(MobsimAgent agent) { Trip trip ; if ( isAtRealActivity( agent ) ) { Activity activity = (Activity) WithinDayAgentUtils.getCurrentPlanElement(agent) ; trip = editTrips.findTripAfterActivity(WithinDayAgentUtils.getModifiablePlan(agent), activity) ; } else { trip = editTrips.findCurrentTrip(agent) ; } return tripRouter.getMainModeIdentifier().identifyMainMode(trip.getTripElements()) ; } public void flushEverythingBeyondCurrent(MobsimAgent agent) {