diff --git a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java index 324fcf9a..b9bae50c 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java +++ b/src/main/java/org/matsim/freight/logistics/examples/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirect.java @@ -603,7 +603,7 @@ public void setEmbeddingContainer(LSP pointer) {} public void handleEvent(CarrierTourEndEvent event) { score++; // use event handlers to compute score. In this case, score is incremented by one every time - // a service and a tour ends. + // a CarrierService and a tour ends. } @Override @@ -615,7 +615,7 @@ public void reset(int iteration) { public void handleEvent(CarrierServiceEndEvent event) { score++; // use event handlers to compute score. In this case, score is incremented by one every time - // a service and a tour ends. + // a CarrierService and a tour ends. } } } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java index 7672784a..ad0967f8 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java @@ -94,9 +94,9 @@ private CarrierService convertToCarrierService(LspShipmentWithTime tuple) { builder.setServiceStartTimeWindow(tuple.getLspShipment().getPickupTimeWindow()); builder.setCapacityDemand(tuple.getLspShipment().getSize()); builder.setServiceDuration(tuple.getLspShipment().getDeliveryServiceTime()); - CarrierService service = builder.build(); - pairs.add(new LSPCarrierPair(tuple, service)); - return service; + CarrierService carrierService = builder.build(); + pairs.add(new LSPCarrierPair(tuple, carrierService)); + return carrierService; } @Override @@ -109,12 +109,12 @@ protected void updateShipments() { LSPCarrierPair carrierPair = new LSPCarrierPair(tuple, serviceActivity.getService()); for (LSPCarrierPair pair : pairs) { if (pair.tuple == carrierPair.tuple - && pair.service.getId() == carrierPair.service.getId()) { + && pair.carrierService.getId() == carrierPair.carrierService.getId()) { addShipmentLoadElement(tuple, tour, serviceActivity); addShipmentTransportElement(tuple, tour, serviceActivity); addShipmentUnloadElement(tuple, tour, serviceActivity); - addCollectionTourEndEventHandler(pair.service, tuple, resource, tour); - addCollectionServiceEventHandler(pair.service, tuple, resource); + addCollectionTourEndEventHandler(pair.carrierService, tuple, resource, tour); + addCollectionServiceEventHandler(pair.carrierService, tuple, resource); } } } @@ -246,5 +246,5 @@ private double getUnloadEndTime(Tour tour) { return unloadEndTime; } - private record LSPCarrierPair(LspShipmentWithTime tuple, CarrierService service) {} + private record LSPCarrierPair(LspShipmentWithTime tuple, CarrierService carrierService) {} } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java index 876d92c2..80902b88 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java @@ -181,9 +181,9 @@ private CarrierService convertToCarrierService(LspShipmentWithTime tuple) { CarrierService.Builder.newInstance(serviceId, tuple.getLspShipment().getTo()); builder.setCapacityDemand(tuple.getLspShipment().getSize()); builder.setServiceDuration(tuple.getLspShipment().getDeliveryServiceTime()); - CarrierService service = builder.build(); - pairs.add(new LSPCarrierPair(tuple, service)); - return service; + CarrierService carrierService = builder.build(); + pairs.add(new LSPCarrierPair(tuple, carrierService)); + return carrierService; } @Override @@ -196,12 +196,12 @@ protected void updateShipments() { LSPCarrierPair carrierPair = new LSPCarrierPair(tuple, serviceActivity.getService()); for (LSPCarrierPair pair : pairs) { if (pair.tuple == carrierPair.tuple - && pair.service.getId() == carrierPair.service.getId()) { + && pair.carrierService.getId() == carrierPair.carrierService.getId()) { addShipmentLoadElement(tuple, tour, serviceActivity); addShipmentTransportElement(tuple, tour, serviceActivity); addShipmentUnloadElement(tuple, tour, serviceActivity); - addDistributionTourStartEventHandler(pair.service, tuple, resource, tour); - addDistributionServiceEventHandler(pair.service, tuple, resource); + addDistributionTourStartEventHandler(pair.carrierService, tuple, resource, tour); + addDistributionServiceEventHandler(pair.carrierService, tuple, resource); } } } @@ -294,10 +294,10 @@ private void addShipmentUnloadElement( } } int serviceIndex = tour.getTourElements().indexOf(serviceActivity); - ServiceActivity service = (ServiceActivity) tour.getTourElements().get(serviceIndex); + ServiceActivity serviceAct = (ServiceActivity) tour.getTourElements().get(serviceIndex); - final double startTime = service.getExpectedArrival(); - final double endTime = startTime + service.getDuration(); + final double startTime = serviceAct.getExpectedArrival(); + final double endTime = startTime + serviceAct.getDuration(); Assert.isTrue( endTime >= startTime, "latest End must be later than earliest start. start: " + startTime + " ; end: " + endTime); @@ -369,13 +369,5 @@ private void addDistributionTourStartEventHandler( } } - static class LSPCarrierPair { - private final LspShipmentWithTime tuple; - private final CarrierService service; - - public LSPCarrierPair(LspShipmentWithTime tuple, CarrierService service) { - this.tuple = tuple; - this.service = service; - } - } + private record LSPCarrierPair(LspShipmentWithTime tuple, CarrierService carrierService) {} } diff --git a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java index 6efc211a..76844e08 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java @@ -241,12 +241,12 @@ protected void updateShipments() { lspShipmentWithTime, serviceActivity.getService()); for (LSPShipmentCarrierServicePair pair : pairs) { if (pair.tuple == carrierPair.tuple - && pair.service.getId() == carrierPair.service.getId()) { + && pair.carrierService.getId() == carrierPair.carrierService.getId()) { addShipmentLoadElement(lspShipmentWithTime, tour); addShipmentTransportElement(lspShipmentWithTime, tour, serviceActivity); addShipmentUnloadElement(lspShipmentWithTime, tour, serviceActivity); - addMainTourRunStartEventHandler(pair.service, lspShipmentWithTime, resource, tour); - addMainRunTourEndEventHandler(pair.service, lspShipmentWithTime, resource, tour); + addMainTourRunStartEventHandler(pair.carrierService, lspShipmentWithTime, resource, tour); + addMainRunTourEndEventHandler(pair.carrierService, lspShipmentWithTime, resource, tour); } } } @@ -386,5 +386,5 @@ private void addMainRunTourEndEventHandler( } } - private record LSPShipmentCarrierServicePair(LspShipmentWithTime tuple, CarrierService service) {} + private record LSPShipmentCarrierServicePair(LspShipmentWithTime tuple, CarrierService carrierService) {} }