1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Merge branch 'master' into master

This commit is contained in:
Michal Maciejewski 2017-12-14 12:30:45 -03:00 committed by GitHub
commit 4c2df19064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View file

@ -222,10 +222,13 @@ public class Service extends AbstractJob {
return this; return this;
} }
public Builder<T> addAllRequiredSkills(Skills skills){ public Builder<T> addAllRequiredSkills(Collection<String> skills) {
for(String s : skills.values()){ skillBuilder.addAllSkills(skills);
skillBuilder.addSkill(s); return this;
} }
public Builder<T> addAllRequiredSkills(Skills skills){
skillBuilder.addAllSkills(skills.values());
return this; return this;
} }

View file

@ -261,10 +261,13 @@ public class Shipment extends AbstractJob {
return this; return this;
} }
public Builder addAllRequiredSkills(Skills skills) { public Builder addAllRequiredSkills(Collection<String> skills) {
for (String s : skills.values()) { skillBuilder.addAllSkills(skills);
addRequiredSkill(s); return this;
} }
public Builder addAllRequiredSkills(Skills skills) {
addAllRequiredSkills(skills.values());
return this; return this;
} }

View file

@ -24,6 +24,8 @@ import com.graphhopper.jsprit.core.problem.job.Break;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Collection;
/** /**
* Implementation of {@link Vehicle}. * Implementation of {@link Vehicle}.
@ -234,6 +236,12 @@ public class VehicleImpl extends AbstractVehicle {
return this; return this;
} }
public Builder addAllSkills(Collection<String> skills) {
if (skills == null) throw new IllegalArgumentException("Skills of vehicle " + id + " must not be null");
skillBuilder.addAllSkills(skills);
return this;
}
public Builder addSkill(String skill) { public Builder addSkill(String skill) {
if (skill == null) throw new IllegalArgumentException("Skill of vehicle " + id + " must not be null"); if (skill == null) throw new IllegalArgumentException("Skill of vehicle " + id + " must not be null");
skillBuilder.addSkill(skill); skillBuilder.addSkill(skill);