Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
remove CarrierService and some more not-needed stuff from ScheduledSh…
Browse files Browse the repository at this point in the history
…ipmentLoad
  • Loading branch information
kt86 committed Jul 16, 2024
1 parent 6309574 commit 1ad6c27
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -32,17 +30,13 @@ class ScheduledShipmentLoad implements ShipmentPlanElement {
private final double endTime;
private final LogisticChainElement element;
private final Id<LSPResource> resourceId;
private final Id<Carrier> 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() {
Expand All @@ -69,11 +63,4 @@ public Id<LSPResource> getResourceId() {
return resourceId;
}

public Id<Carrier> getCarrierId() {
return carrierId;
}

public CarrierService getCarrierService() {
return carrierService;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,6 @@ public static final class ScheduledShipmentLoadBuilder {
double endTime;
LogisticChainElement element;
Id<LSPResource> resourceId;
Id<Carrier> carrierId;
Id<Link> linkId;
CarrierService carrierService;

private ScheduledShipmentLoadBuilder() {}

Expand All @@ -378,18 +375,6 @@ public void setResourceId(Id<LSPResource> resourceId) {
this.resourceId = resourceId;
}

public void setLinkId(Id<Link> linkId) {
this.linkId = linkId;
}

public void setCarrierId(Id<Carrier> carrierId) {
this.carrierId = carrierId;
}

public void setCarrierService(CarrierService carrierService) {
this.carrierService = carrierService;
}

public ScheduledShipmentLoad build() {
return new ScheduledShipmentLoad(this);
}
Expand Down

0 comments on commit 1ad6c27

Please sign in to comment.