public PParking getParkingWithShortestWalkingDistance( Coord destCoord, ActInfo targetActInfo, Id personId) { Collection<PParking> parkingsInSurroundings = getParkingsInSurroundings( destCoord, ParkingConfigModule.getStartParkingSearchDistanceInMeters(), personId, 0, targetActInfo, parkingManager.getParkings()); return getParkingWithShortestWalkingDistance(destCoord, parkingsInSurroundings); }
private Collection<PParking> filterReservedAndFullParkings( Id personId, double OPTIONALtimeOfDayInSeconds, ActInfo targetActInfo, Collection<PParking> collection) { Collection<PParking> resultCollection = new LinkedList<PParking>(); boolean isPersonLookingForCertainTypeOfParking = false; if (parkingManager.getPreferredParkingManager() != null) { isPersonLookingForCertainTypeOfParking = parkingManager .getPreferredParkingManager() .isPersonLookingForCertainTypeOfParking( personId, OPTIONALtimeOfDayInSeconds, targetActInfo); } for (PParking parking : collection) { if (!((ParkingImpl) parking).hasFreeCapacity()) { continue; } if (isPersonLookingForCertainTypeOfParking) { if (parking instanceof PreferredParking) { PreferredParking preferredParking = (PreferredParking) parking; if (parkingManager .getPreferredParkingManager() .considerForChoiceSet( preferredParking, personId, OPTIONALtimeOfDayInSeconds, targetActInfo)) { resultCollection.add(parking); } } continue; } if (parking instanceof ReservedParking) { if (parkingManager.getReservedParkingManager() == null) { DebugLib.stopSystemAndReportInconsistency("The reservedParkingManager must be set!"); } ReservedParking reservedParking = (ReservedParking) parking; if (parkingManager .getReservedParkingManager() .considerForChoiceSet( reservedParking, personId, OPTIONALtimeOfDayInSeconds, targetActInfo)) { resultCollection.add(parking); } } else if (parking instanceof PrivateParking) { PrivateParking privateParking = (PrivateParking) parking; if (privateParking.getActInfo().getFacilityId().equals(targetActInfo.getFacilityId()) && privateParking.getActInfo().getActType().equals(targetActInfo.getActType())) { resultCollection.add(parking); } } else { resultCollection.add(parking); } } return resultCollection; }