1
0
Fork 0
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:
Stefan Schroeder 2013-09-02 17:20:49 +02:00
parent 8195ef0618
commit 4b8876b1c6

View file

@ -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;
} }