/**
  * Create and add to schedule new stops with the id-endings "_1" to "_numberOfCopies" by copying
  * the provided stopFacility.
  *
  * @param stopFacility which will be copied. The original becomes the first element of the
  *     returned array.
  * @param numberOfCopies of stopFacility which are created.
  * @return TransitStopFacilities stopFacility, and copies stop_1 to stop_numberOfCopies
  */
 private TransitStopFacility[] multiplyStop(TransitStopFacility stopFacility, int numberOfCopies) {
   TransitStopFacility[] facilities = new TransitStopFacility[numberOfCopies + 1];
   facilities[0] = stopFacility;
   for (int i = 1; i <= numberOfCopies; i++) {
     // Copy facility at stopFacility:
     Id<TransitStopFacility> idNewFacility =
         Id.create(stopFacility.getId().toString() + "_" + i, TransitStopFacility.class);
     TransitStopFacility newFacility =
         this.scheduleFactory.createTransitStopFacility(
             idNewFacility, stopFacility.getCoord(), stopFacility.getIsBlockingLane());
     newFacility.setName(stopFacility.getName());
     // Add new facility to schedule and to array:
     facilities[i] = newFacility;
   }
   return facilities;
 }
 private void setConnectedStopFacilitiesToIsBlocking() {
   Set<TransitStopFacility> facilitiesToExchange = new HashSet<>();
   for (TransitStopFacility oldFacility : this.schedule.getFacilities().values()) {
     if (this.network
         .getLinks()
         .get(oldFacility.getLinkId())
         .getAllowedModes()
         .contains(TransportMode.car)) {
       TransitStopFacility newFacility =
           this.scheduleFactory.createTransitStopFacility(
               oldFacility.getId(), oldFacility.getCoord(), true);
       newFacility.setName(oldFacility.getName());
       newFacility.setLinkId(oldFacility.getLinkId());
       newFacility.setStopPostAreaId(oldFacility.getStopPostAreaId());
       facilitiesToExchange.add(newFacility);
     }
   }
   for (TransitStopFacility facility : facilitiesToExchange) {
     TransitStopFacility facilityToRemove = this.schedule.getFacilities().get(facility.getId());
     this.schedule.removeStopFacility(facilityToRemove);
     this.schedule.addStopFacility(facility);
   }
 }