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

Commit

Permalink
minor change based on code inspection; optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Jan 19, 2024
1 parent a8ad2b0 commit 1cb4168
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@

import java.util.Random;
import org.matsim.core.gbl.Gbl;
import org.matsim.freight.logistics.LSP;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.shipment.LSPShipment;

/*package-private*/ class MaybeTodayAssigner implements InitialShipmentAssigner {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.matsim.freight.logistics.example.lsp.multipleChains;

import org.matsim.core.gbl.Gbl;
import org.matsim.freight.logistics.LSP;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.LogisticChain;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.shipment.LSPShipment;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RandomLogisticChainShipmentAssigner implements InitialShipmentAssigner {

@Override
public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) {
Gbl.assertIf(lspPlan.getLogisticChains().size() > 0);
Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty());
List<LogisticChain> logisticChains = new ArrayList<>(lspPlan.getLogisticChains());
Random rand = MatsimRandom.getRandom();
int index = rand.nextInt(logisticChains.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import java.util.LinkedHashMap;
import java.util.Map;
import org.matsim.core.gbl.Gbl;
import org.matsim.freight.logistics.LSP;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.LogisticChain;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.shipment.LSPShipment;

/**
Expand All @@ -26,7 +25,7 @@ class RoundRobinLogisticChainShipmentAssigner implements InitialShipmentAssigner

@Override
public void assignToPlan(LSPPlan lspPlan, LSPShipment shipment) {
Gbl.assertIf(lspPlan.getLogisticChains().size() > 0);
Gbl.assertIf(!lspPlan.getLogisticChains().isEmpty());
// prepare the map if empty for the first time with each number of assigned shipments being zero
if (shipmentCountByChain.isEmpty()) {
for (LogisticChain chain : lspPlan.getLogisticChains()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@

import java.util.ArrayList;
import java.util.Collection;
import org.matsim.freight.logistics.LSP;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.LogisticChain;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.shipment.LSPShipment;
import org.matsim.freight.logistics.shipment.Requirement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
package org.matsim.freight.logistics.resourceImplementations;

import org.matsim.core.gbl.Gbl;
import org.matsim.freight.logistics.LSP;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.LSPPlan;
import org.matsim.freight.logistics.LogisticChain;
import org.matsim.freight.logistics.InitialShipmentAssigner;
import org.matsim.freight.logistics.shipment.LSPShipment;

/**
Expand Down

0 comments on commit 1cb4168

Please sign in to comment.