mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add precondition to service: capacity-demand must be greater than or
equal to zero
This commit is contained in:
parent
8195ef0618
commit
4b8876b1c6
1 changed files with 2 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ public class Service implements Job {
|
||||||
protected int demand;
|
protected int demand;
|
||||||
|
|
||||||
Builder(String id, int size) {
|
Builder(String id, int size) {
|
||||||
super();
|
if(size < 0) throw new IllegalArgumentException("size must be greater than or equal to zero");
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.demand = size;
|
this.demand = size;
|
||||||
}
|
}
|
||||||
|
|
@ -62,6 +62,7 @@ public class Service implements Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setServiceTime(double serviceTime){
|
public Builder setServiceTime(double serviceTime){
|
||||||
|
if(serviceTime < 0) throw new IllegalArgumentException("serviceTime must be greate than or equal to zero");
|
||||||
this.serviceTime = serviceTime;
|
this.serviceTime = serviceTime;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue