From 1ad6c270da85643538517d01f3ae706a927a846e Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Tue, 16 Jul 2024 13:25:12 +0200 Subject: [PATCH] remove CarrierService and some more not-needed stuff from ScheduledShipmentLoad --- .../CollectionCarrierScheduler.java | 4 +--- .../DistributionCarrierScheduler.java | 3 --- .../MainRunCarrierScheduler.java | 8 +++----- .../shipment/ScheduledShipmentLoad.java | 17 ++--------------- .../logistics/shipment/ShipmentUtils.java | 15 --------------- 5 files changed, 6 insertions(+), 41 deletions(-) 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 eb9b5ffb..abb31c8f 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/CollectionCarrierScheduler.java @@ -145,9 +145,7 @@ private void addShipmentLoadElement( legBeforeService.getExpectedDepartureTime() + legBeforeService.getExpectedTransportTime(); builder.setStartTime(startTimeOfLoading); builder.setEndTime(startTimeOfLoading + tuple.getShipment().getDeliveryServiceTime()); - builder.setCarrierId(carrier.getId()); - builder.setLinkId(serviceActivity.getLocation()); - builder.setCarrierService(serviceActivity.getService()); + ShipmentPlanElement load = builder.build(); String idString = load.getResourceId() + "" + load.getLogisticChainElement().getId() + load.getElementType(); 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 7982cbf5..1b1462d6 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/DistributionCarrierScheduler.java @@ -237,9 +237,6 @@ private void addShipmentLoadElement( } builder.setStartTime(startTimeOfTransport - cumulatedLoadingTime); builder.setEndTime(startTimeOfTransport); - builder.setCarrierId(carrier.getId()); - builder.setLinkId(tour.getStartLinkId()); - builder.setCarrierService(serviceActivity.getService()); ShipmentPlanElement load = builder.build(); String idString = 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 973cf57c..5ae68ec7 100644 --- a/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java +++ b/src/main/java/org/matsim/freight/logistics/resourceImplementations/MainRunCarrierScheduler.java @@ -262,7 +262,7 @@ protected void updateShipments() { for (LSPShipmentCarrierServicePair pair : pairs) { if (pair.tuple == carrierPair.tuple && pair.service.getId() == carrierPair.service.getId()) { - addShipmentLoadElement(lspShipmentWithTime, tour, serviceActivity); + addShipmentLoadElement(lspShipmentWithTime, tour); addShipmentTransportElement(lspShipmentWithTime, tour, serviceActivity); addShipmentUnloadElement(lspShipmentWithTime, tour, serviceActivity); addMainTourRunStartEventHandler(pair.service, lspShipmentWithTime, resource, tour); @@ -276,7 +276,7 @@ protected void updateShipments() { } private void addShipmentLoadElement( - LspShipmentWithTime tuple, Tour tour, Tour.ServiceActivity serviceActivity) { + LspShipmentWithTime tuple, Tour tour) { ShipmentUtils.ScheduledShipmentLoadBuilder builder = ShipmentUtils.ScheduledShipmentLoadBuilder.newInstance(); builder.setResourceId(resource.getId()); @@ -297,9 +297,7 @@ private void addShipmentLoadElement( } builder.setStartTime(startTimeOfTransport - cumulatedLoadingTime); builder.setEndTime(startTimeOfTransport); - builder.setCarrierId(carrier.getId()); - builder.setLinkId(tour.getStartLinkId()); - builder.setCarrierService(serviceActivity.getService()); + ShipmentPlanElement load = builder.build(); String idString = load.getResourceId() diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java index 66d20912..c9164338 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ScheduledShipmentLoad.java @@ -21,8 +21,6 @@ package org.matsim.freight.logistics.shipment; import org.matsim.api.core.v01.Id; -import org.matsim.freight.carriers.Carrier; -import org.matsim.freight.carriers.CarrierService; import org.matsim.freight.logistics.LSPResource; import org.matsim.freight.logistics.LogisticChainElement; @@ -32,17 +30,13 @@ class ScheduledShipmentLoad implements ShipmentPlanElement { private final double endTime; private final LogisticChainElement element; private final Id resourceId; - private final Id carrierId; - private final CarrierService carrierService; - ScheduledShipmentLoad(ShipmentUtils.ScheduledShipmentLoadBuilder builder) { + ScheduledShipmentLoad(ShipmentUtils.ScheduledShipmentLoadBuilder builder) { this.startTime = builder.startTime; this.endTime = builder.endTime; this.element = builder.element; this.resourceId = builder.resourceId; - this.carrierId = builder.carrierId; - this.carrierService = builder.carrierService; - } + } @Override public String getElementType() { @@ -69,11 +63,4 @@ public Id getResourceId() { return resourceId; } - public Id getCarrierId() { - return carrierId; - } - - public CarrierService getCarrierService() { - return carrierService; - } } diff --git a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java b/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java index 75f9f82f..b1a456d1 100644 --- a/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java +++ b/src/main/java/org/matsim/freight/logistics/shipment/ShipmentUtils.java @@ -352,9 +352,6 @@ public static final class ScheduledShipmentLoadBuilder { double endTime; LogisticChainElement element; Id resourceId; - Id carrierId; - Id linkId; - CarrierService carrierService; private ScheduledShipmentLoadBuilder() {} @@ -378,18 +375,6 @@ public void setResourceId(Id resourceId) { this.resourceId = resourceId; } - public void setLinkId(Id linkId) { - this.linkId = linkId; - } - - public void setCarrierId(Id carrierId) { - this.carrierId = carrierId; - } - - public void setCarrierService(CarrierService carrierService) { - this.carrierService = carrierService; - } - public ScheduledShipmentLoad build() { return new ScheduledShipmentLoad(this); }