@Override public final void resetCaches() { if ( this.getCurrentPlanElement() instanceof Activity ) { Activity act = (Activity) this.getCurrentPlanElement() ; this.calculateAndSetDepartureTime(act); } }
public BasicPlanAgentImpl(Plan plan2, Scenario scenario, EventsManager events, MobsimTimer simTimer) { this.plan = PopulationUtils.unmodifiablePlan(plan2) ; // yy MZ suggests, and I agree, to always give the agent a full plan, and consume that plan as the agent goes. kai, nov'14 this.scenario = scenario ; this.events = events ; this.simTimer = simTimer ; List<PlanElement> planElements = this.getCurrentPlan().getPlanElements(); if (planElements.size() > 0) { Activity firstAct = (Activity) planElements.get(0); // this.setCurrentLinkId( firstAct.getLinkId() ) ; final Id<Link> linkId = PopulationUtils.computeLinkIdFromActivity(firstAct, scenario.getActivityFacilities(), scenario.getConfig() ); Gbl.assertIf( linkId!=null ); this.setCurrentLinkId( linkId ); this.setState(MobsimAgent.State.ACTIVITY) ; calculateAndSetDepartureTime(firstAct); } }
private void initializeActivity(Activity act, double now) { this.setState(MobsimAgent.State.ACTIVITY) ; this.getEvents().processEvent( new ActivityStartEvent(now, this.getId(), this.getCurrentLinkId(), act.getFacilityId(), act.getType())); calculateAndSetDepartureTime(act); getModifiablePlan(); // this is necessary to make the plan modifiable, so that setting the start time (next line) is actually feasible. kai/mz, oct'16 ((Activity) getCurrentPlanElement()).setStartTime(now); }