From 5d71e55677941b55c7307e3aada600845fcf0b14 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Fri, 20 Dec 2024 13:09:44 +0100 Subject: [PATCH] make id final --- .../java/org/matsim/freight/carriers/CarrierShipment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java index dd12b8957b8..93e9dc590fe 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierShipment.java @@ -45,7 +45,7 @@ public final class CarrierShipment implements CarrierJob { */ public static class Builder { - private Id id; + private final Id id; private final int demand; private final Id pickupLinkId; @@ -71,7 +71,8 @@ public static class Builder { */ @Deprecated public static Builder newInstance(Id from, Id to, int size){ - return new Builder(from,to,size); + var id = Id.create(CarrierConstants.SHIPMENT +"_" + from.toString() + "_" + to.toString(), CarrierShipment.class); + return new Builder(id, from,to,size); } /** @@ -95,6 +96,7 @@ public static Builder newInstance(Id id, Id from, Id pickupLinkId, Id deliveryLinkId, int demand) { super(); + this.id = Id.create(CarrierConstants.SHIPMENT +"_" + pickupLinkId.toString() + "_" + deliveryLinkId.toString(), CarrierShipment.class); this.pickupLinkId = pickupLinkId; this.deliveryLinkId = deliveryLinkId; this.demand = demand;