@Override public void handleAgentLeg(AgentWithParking aem) { Id personId = aem.getPerson().getId(); boolean endOfLegReached = aem.endOfLegReached(); if (endOfLegReached) { if (!parkingFound.contains(personId)) { parkingFound.add(personId); DebugLib.traceAgent(personId); Activity nextAct = (Activity) aem.getPerson() .getSelectedPlan() .getPlanElements() .get(aem.getPlanElementIndex() + 3); Id parkingId = AgentWithParking.parkingManager.getFreePrivateParking( nextAct.getFacilityId(), nextAct.getType()); if (isInvalidParking(aem, parkingId)) { parkingId = AgentWithParking.parkingManager.getClosestParkingFacilityNotOnLink( nextAct.getCoord(), aem.getInvalidLinkForParking()); } parkVehicleAndLogSearchTime(aem, personId, parkingId); } } else { super.handleAgentLeg(aem); } }
@Override public void handleAgentLeg(AgentWithParking aem) { Activity nextAct = (Activity) aem.getPerson().getSelectedPlan().getPlanElements().get(aem.getPlanElementIndex() + 3); if (GeneralLib.getDistance( getCurrentLink(aem).getCoord(), network.getLinks().get(nextAct.getLinkId()).getCoord()) < distanceToDestinationForStartingRandomSearch) { throughAwayRestOfRoute(aem); } super.handleAgentLeg(aem); }
@Override public void handleParkingDepartureActivity(AgentWithParking aem) { super.handleParkingDepartureActivity(aem); parkingFound.remove(aem.getPerson().getId()); }