19 package org.matsim.core.mobsim.qsim.agents;
21 import java.util.List;
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
35 import com.google.common.base.MoreObjects;
47 this.basicPlanAgentDelegate = basicAgent ;
56 if (expectedLinkWarnCount < 10 && !newLinkId.
equals(
this.cachedNextLinkId)) {
57 log.warn(
"Agent did not end up on expected link. Ok for within-day replanning agent, otherwise not. Continuing " +
"anyway ... This warning is suppressed after the first 10 warnings.") ;
58 expectedLinkWarnCount++;
60 this.basicPlanAgentDelegate.setCurrentLinkId( newLinkId ) ;
61 this.basicPlanAgentDelegate.incCurrentLinkIndex();
62 this.cachedNextLinkId = null;
86 if (this.cachedNextLinkId != null && !(this.cachedNextLinkId.
equals(
this.getCurrentLinkId())) ) {
98 List<Id<Link>> routeLinkIds = ((
NetworkRoute) this.basicPlanAgentDelegate.getCurrentLeg().
getRoute()).getLinkIds();
134 final List<Id<Link>> routeLinkIds = ((
NetworkRoute) this.basicPlanAgentDelegate.getCurrentLeg().
getRoute()).getLinkIds();
135 final int routeLinkIdsSize = routeLinkIds.size();
187 this.cachedNextLinkId = null;
194 if (basicPlanAgentDelegate.getCurrentLeg().
getRoute() == null) {
195 log.error(
"The agent " + this.
getId() +
" has no route in its leg. Setting agent state to abort." );
207 return this.basicPlanAgentDelegate.
getId();
222 this.basicPlanAgentDelegate.
setVehicle( veh );
227 return this.basicPlanAgentDelegate.
getVehicle() ;
237 return this.basicPlanAgentDelegate.
getMode();
242 return MoreObjects.toStringHelper(
this).add(
"basicPlanAgentDelegate", basicPlanAgentDelegate).toString();
final Id< Person > getId()
final int getCurrentLinkIndex()
BasicPlanAgentImpl basicPlanAgentDelegate
static int expectedLinkWarnCount
Id< Link > getDestinationLinkId()
static< T > Id< T > get(int index, final Class< T > type)
final void setVehicle(MobsimVehicle vehicle)
final Id< Link > getCurrentLinkId()
final Id< Link > chooseNextLinkId()
final PlanElement getCurrentPlanElement()
void setVehicle(MobsimVehicle veh)
final Id< Vehicle > getPlannedVehicleId()
final boolean isWantingToArriveOnCurrentLink()
final Id< Link > getDestinationLinkId()
PlanBasedDriverAgentImpl(BasicPlanAgentImpl basicAgent)
Id< Link > getCurrentLinkId()
final MobsimVehicle getVehicle()
final void notifyMoveOverNode(Id< Link > newLinkId)
Id< Vehicle > getPlannedVehicleId()
boolean equals(Object obj)
MobsimVehicle getVehicle()
Id< Link > cachedNextLinkId