-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3577 from matsim-org/developToolForFreightGeneration
Develop tool for freight generation
- Loading branch information
Showing
6 changed files
with
414 additions
and
169 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...cation/src/main/java/org/matsim/freightDemandGeneration/DefaultJobDurationCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.matsim.freightDemandGeneration; | ||
|
||
import org.matsim.api.core.v01.Scenario; | ||
|
||
public class DefaultJobDurationCalculator implements JobDurationCalculator { | ||
@Override | ||
public double calculateServiceDuration(Integer serviceTimePerUnit, int demandForThisService) { | ||
return getDefaultCalculation(serviceTimePerUnit, demandForThisService); | ||
} | ||
|
||
@Override | ||
public double calculatePickupDuration(Integer pickupDurationPerUnit, int demandForThisShipment) { | ||
return getDefaultCalculation(pickupDurationPerUnit, demandForThisShipment); | ||
} | ||
|
||
@Override | ||
public double calculateDeliveryDuration(Integer deliveryDurationPerUnit, int demandForThisShipment) { | ||
return getDefaultCalculation(deliveryDurationPerUnit, demandForThisShipment); | ||
} | ||
|
||
@Override | ||
public void recalculateJobDurations(Scenario scenario) { | ||
// do nothing | ||
} | ||
|
||
/** | ||
* @param timePerUnit time per unit | ||
* @param demandForThisService demand for this service | ||
* @return default calculation | ||
*/ | ||
private int getDefaultCalculation(int timePerUnit, int demandForThisService) { | ||
if (demandForThisService == 0) | ||
return timePerUnit; | ||
else | ||
return timePerUnit * demandForThisService; | ||
} | ||
} |
Oops, something went wrong.