mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add helper methods - related to #380
This commit is contained in:
parent
c465cf16da
commit
0dfffdd9dd
2 changed files with 19 additions and 4 deletions
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
package com.graphhopper.jsprit.core.problem.job;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.AbstractJob;
|
||||
import com.graphhopper.jsprit.core.problem.Capacity;
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
|
|
@ -28,6 +26,8 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindows;
|
|||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindowsImpl;
|
||||
import com.graphhopper.jsprit.core.util.Coordinate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Service implementation of a job.
|
||||
* <p>
|
||||
|
|
@ -194,6 +194,11 @@ public class Service extends AbstractJob {
|
|||
return addTimeWindow(TimeWindow.newInstance(earliest, latest));
|
||||
}
|
||||
|
||||
public Builder<T> addAllTimeWindows(Collection<TimeWindow> timeWindows) {
|
||||
for (TimeWindow tw : timeWindows) addTimeWindow(tw);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the service.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
package com.graphhopper.jsprit.core.problem.job;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.AbstractJob;
|
||||
import com.graphhopper.jsprit.core.problem.Capacity;
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
|
|
@ -26,6 +24,8 @@ import com.graphhopper.jsprit.core.problem.Skills;
|
|||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindowsImpl;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Shipment is an implementation of Job and consists of a pickup and a delivery of something.
|
||||
|
|
@ -277,6 +277,11 @@ public class Shipment extends AbstractJob {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder addAllDeliveryTimeWindows(Collection<TimeWindow> timeWindow) {
|
||||
for (TimeWindow tw : timeWindow) addDeliveryTimeWindow(tw);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addPickupTimeWindow(TimeWindow timeWindow) {
|
||||
if(timeWindow == null) throw new IllegalArgumentException("time-window arg must not be null");
|
||||
if(!pickupTimeWindowAdded){
|
||||
|
|
@ -291,6 +296,11 @@ public class Shipment extends AbstractJob {
|
|||
return addPickupTimeWindow(TimeWindow.newInstance(earliest, latest));
|
||||
}
|
||||
|
||||
public Builder addAllPickupTimeWindows(Collection<TimeWindow> timeWindow) {
|
||||
for (TimeWindow tw : timeWindow) addPickupTimeWindow(tw);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priority to shipment. Only 1 (high) to 10 (low) are allowed.
|
||||
* <p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue