From 05146bca0174e6ff717a5fda95e385f6480e1abc Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Wed, 27 Nov 2024 13:13:22 +0100 Subject: [PATCH] Add a CarrierJob interface and put CarrierService and CarrierShipment behind it. --- .../matsim/freight/carriers/CarrierJob.java | 19 +++++++++++++++++++ .../freight/carriers/CarrierService.java | 2 +- .../freight/carriers/CarrierShipment.java | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierJob.java diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierJob.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierJob.java new file mode 100644 index 00000000000..3654fbff36a --- /dev/null +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierJob.java @@ -0,0 +1,19 @@ +package org.matsim.freight.carriers; + +import org.matsim.utils.objectattributes.attributable.Attributable; + +/** + * A job that a {@link Carrier} can do. + *

+ * In a first step this is more or less a marker interface. + *

+ * In the next steps it will be extended, as follows + * 1) existing common methods of {@link CarrierShipment} and {@link + * CarrierService} where moved up here + * 2) some similiar, but differently named methods of {@link + * CarrierShipment} and {@link CarrierService} were renamed to the same name and moved up here + * ... + * future) It maybe gets generalized in way, that we only have one job definition with 1 or 2 + * location(s). This then defines, if jsprit takes the job as a service or as a shipment. + */ +public interface CarrierJob extends Attributable {} diff --git a/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java index b7106fa6de9..7500b10887d 100644 --- a/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java +++ b/contribs/freight/src/main/java/org/matsim/freight/carriers/CarrierService.java @@ -28,7 +28,7 @@ import org.matsim.utils.objectattributes.attributable.AttributesImpl; -public final class CarrierService implements Attributable { +public final class CarrierService implements CarrierJob { public static class Builder { 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 9472ffaac91..489657ba54e 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 @@ -36,7 +36,7 @@ * @author sschroeder * */ -public final class CarrierShipment implements Attributable { +public final class CarrierShipment implements CarrierJob { /** * A builder that builds shipments.