From e214b11b82d0b5ed4c4cc614b699cc7436702305 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Wed, 11 Oct 2023 15:05:13 +0200 Subject: [PATCH] rename remaining FreightUtils to CarrierControlerUtils --- .../matsim/contrib/freight/carriers/carrier/CarrierUtils.java | 2 +- .../{FreightUtils.java => CarrierControlerUtils.java} | 2 +- .../freight/carriers/usecases/chessboard/RunChessboard.java | 2 +- .../usecases/chessboard/RunPassengerAlongWithCarriers.java | 2 +- .../org/matsim/contrib/freight/carriers/jsprit/SkillsIT.java | 4 ++-- .../carriers/mobsim/StrategyManagerFactoryForTests.java | 4 ++-- .../{FreightUtilsIT.java => CarrierControlerUtilsIT.java} | 2 +- .../{FreightUtilsTest.java => CarrierControlerUtilsTest.java} | 4 ++-- .../ReceiverTriggersCarrierReplanningListener.java | 2 +- .../org/matsim/contrib/freightreceiver/ReceiverUtils.java | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) rename contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/{FreightUtils.java => CarrierControlerUtils.java} (97%) rename contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/{FreightUtilsIT.java => CarrierControlerUtilsIT.java} (99%) rename contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/{FreightUtilsTest.java => CarrierControlerUtilsTest.java} (99%) diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/carrier/CarrierUtils.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/carrier/CarrierUtils.java index d882cb83197..039d51170a1 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/carrier/CarrierUtils.java +++ b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/carrier/CarrierUtils.java @@ -296,7 +296,7 @@ public static Carriers getCarriers(Scenario scenario) { // not found. kai, oct'19 if ( scenario.getScenarioElement( CARRIERS ) == null ) { throw new RuntimeException( "cannot retrieve carriers from scenario; typical ways to resolve that problem are to call " + - "FreightUtils.getOrCreateCarriers(...) or FreightUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ; + "CarrierControlerUtils.getOrCreateCarriers(...) or CarrierControlerUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ; } return (Carriers) scenario.getScenarioElement(CARRIERS); } diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/FreightUtils.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/CarrierControlerUtils.java similarity index 97% rename from contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/FreightUtils.java rename to contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/CarrierControlerUtils.java index b231e560f6d..0c6311cc1e5 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/FreightUtils.java +++ b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/controler/CarrierControlerUtils.java @@ -27,7 +27,7 @@ * @author kturner * */ -public class FreightUtils { +public class CarrierControlerUtils { public static CarrierStrategyManager createDefaultCarrierStrategyManager() { return new CarrierStrategyManagerImpl(); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunChessboard.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunChessboard.java index 125d8a53d75..807283ba149 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunChessboard.java +++ b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunChessboard.java @@ -141,7 +141,7 @@ private static class MyCarrierPlanStrategyManagerProvider implements Provider strategy = new GenericPlanStrategyImpl<>( new ExpBetaPlanChanger.Factory().build() ); diff --git a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java index c20ac9456aa..53852b51482 100644 --- a/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java +++ b/contribs/freight/src/main/java/org/matsim/contrib/freight/carriers/usecases/chessboard/RunPassengerAlongWithCarriers.java @@ -156,7 +156,7 @@ public MyCarrierPlanStrategyManagerFactory(CarrierVehicleTypes types) { final TravelDisutility travelDisutility = CarrierTravelDisutilities.createBaseDisutility(types, modeTravelTimes.get(TransportMode.car ) ); final LeastCostPathCalculator router = leastCostPathCalculatorFactory.createPathCalculator(network, travelDisutility, modeTravelTimes.get(TransportMode.car)); - final CarrierStrategyManager carrierStrategyManager = FreightUtils.createDefaultCarrierStrategyManager(); + final CarrierStrategyManager carrierStrategyManager = CarrierControlerUtils.createDefaultCarrierStrategyManager(); carrierStrategyManager.setMaxPlansPerAgent(5); carrierStrategyManager.addStrategy(new GenericPlanStrategyImpl<>(new BestPlanSelector<>()), null, 0.95); diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/jsprit/SkillsIT.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/jsprit/SkillsIT.java index 495b305fa8c..2ac0b61189c 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/jsprit/SkillsIT.java +++ b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/jsprit/SkillsIT.java @@ -93,9 +93,9 @@ private VehicleRoutingProblemSolution generateCarrierPlans(Scenario scenario) { carrier.setSelectedPlan(newPlan); SolutionPrinter.print(problem, solution, SolutionPrinter.Print.VERBOSE); -// new CarrierPlanXmlWriterV3(FreightUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml"); +// new CarrierPlanXmlWriterV3(CarrierControlerUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml"); // Scenario scNew = ScenarioUtils.createScenario(ConfigUtils.createConfig()); -// new CarrierPlanXmlReaderV3(FreightUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml"); +// new CarrierPlanXmlReaderV3(CarrierControlerUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml"); return solution; } diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/mobsim/StrategyManagerFactoryForTests.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/mobsim/StrategyManagerFactoryForTests.java index f022fee0931..eb38eda3fc4 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/mobsim/StrategyManagerFactoryForTests.java +++ b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/mobsim/StrategyManagerFactoryForTests.java @@ -8,9 +8,9 @@ import org.matsim.api.core.v01.population.Person; import org.matsim.contrib.freight.carriers.carrier.Carrier; import org.matsim.contrib.freight.carriers.carrier.CarrierPlan; +import org.matsim.contrib.freight.carriers.controler.CarrierControlerUtils; import org.matsim.contrib.freight.carriers.controler.CarrierReRouteVehicles; import org.matsim.contrib.freight.carriers.controler.CarrierStrategyManager; -import org.matsim.contrib.freight.carriers.controler.FreightUtils; import org.matsim.core.replanning.GenericPlanStrategyImpl; import org.matsim.core.replanning.selectors.BestPlanSelector; import org.matsim.core.router.speedy.SpeedyALTFactory; @@ -62,7 +62,7 @@ public CarrierStrategyManager get() { GenericPlanStrategyImpl planStrat_reRoutePlan = new GenericPlanStrategyImpl<>( new BestPlanSelector<>() ); planStrat_reRoutePlan.addStrategyModule(new CarrierReRouteVehicles.Factory(router, network, travelTimes.get(TransportMode.car )).build() ); - CarrierStrategyManager stratManager = FreightUtils.createDefaultCarrierStrategyManager(); + CarrierStrategyManager stratManager = CarrierControlerUtils.createDefaultCarrierStrategyManager(); stratManager.addStrategy(planStrat_reRoutePlan, null, 1.0); diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsIT.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsIT.java similarity index 99% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsIT.java rename to contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsIT.java index 07de36b1c74..2afabcfc453 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsIT.java +++ b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsIT.java @@ -49,7 +49,7 @@ * @author kturner * */ -public class FreightUtilsIT { +public class CarrierControlerUtilsIT { private final Id CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class); private final Id CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class); diff --git a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsTest.java b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsTest.java similarity index 99% rename from contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsTest.java rename to contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsTest.java index 06b2546e1ef..e84bc83e056 100644 --- a/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/FreightUtilsTest.java +++ b/contribs/freight/src/test/java/org/matsim/contrib/freight/carriers/utils/CarrierControlerUtilsTest.java @@ -55,12 +55,12 @@ import java.util.Collection; import java.util.concurrent.ExecutionException; -public class FreightUtilsTest { +public class CarrierControlerUtilsTest { @Rule public MatsimTestUtils utils = new MatsimTestUtils(); - private static final Logger log = LogManager.getLogger(FreightUtilsTest.class); + private static final Logger log = LogManager.getLogger(CarrierControlerUtilsTest.class); private final Id CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class); private final Id CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java index c06aef03b49..8f54ebb320f 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverTriggersCarrierReplanningListener.java @@ -120,7 +120,7 @@ public void notifyIterationStarts(IterationStartsEvent event) { } String outputdirectory = sc.getConfig().controler().getOutputDirectory(); outputdirectory += outputdirectory.endsWith("/") ? "" : "/"; -// new CarrierPlanWriter(FreightUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE); +// new CarrierPlanWriter(CarrierControlerUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE); new CarrierPlanWriter(CarrierUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() ); // new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + ReceiverConfigGroup.RECEIVERS_FILE); new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + receiverConfig.getReceiversFile()); diff --git a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java index f15683f6905..57c9b8e99cc 100644 --- a/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java +++ b/contribs/freightreceiver/src/main/java/org/matsim/contrib/freightreceiver/ReceiverUtils.java @@ -19,7 +19,7 @@ private ReceiverUtils() { public static final String ATTR_RECEIVER_SCORE = "score"; public static final String ATTR_RECEIVER_TW_COST = "twCost"; - //Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) FreightUtils and here. + //Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) CarrierControlerUtils and here. // I also replaced the usage here by the current MATSim syntax KMT'jan21 // private static final String CARRIERS_SCENARIO_ELEMENT = "carriers";