@Override public final Person getPerson() { return basicAgentDelegate.getPerson(); } @Override
@Override public final Person getPerson() { return basicAgentDelegate.getPerson(); }
private void initializeLeg(Leg leg) { this.setState(MobsimAgent.State.LEG) ; this.currentLinkIndex = 0 ; if (leg.getRoute() == null) { log.error("The agent " + this.getPerson().getId() + " has no route in its leg. Setting agent state to ABORT."); if ( noRouteWrnCnt < 1 ) { log.info( "(Route is needed inside Leg even if you want teleportation since Route carries the start/endLinkId info.)") ; noRouteWrnCnt++ ; } this.setState(MobsimAgent.State.ABORT) ; // throw new RuntimeException("no route in leg") ; } }
@Override public final void endActivityAndComputeNextState(final double now) { Activity act = (Activity) this.getCurrentPlanElement() ; this.getEvents().processEvent( new ActivityEndEvent(now, this.getPerson().getId(), this.currentLinkId, act.getFacilityId(), act.getType())); // note that when we are here we don't know if next is another leg, or an activity Therefore, we go to a general method: advancePlan(now); } @Override
@Override public final void endLegAndComputeNextState(final double now) { this.getEvents().processEvent(new PersonArrivalEvent( now, this.getId(), this.getDestinationLinkId(), getCurrentLeg().getMode())); if( (!(this.getCurrentLinkId() == null && this.getDestinationLinkId() == null)) && !this.getCurrentLinkId().equals(this.getDestinationLinkId())) { log.error("The agent " + this.getPerson().getId() + " has destination link " + this.getDestinationLinkId() + ", but arrived on link " + this.getCurrentLinkId() + ". Setting agent state to ABORT."); this.setState(MobsimAgent.State.ABORT) ; } else { // note that when we are here we don't know if next is another leg, or an activity Therefore, we go to a general method: advancePlan(now) ; } this.currentLinkIndex = 0 ; }