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

add helper methods for skills

This commit is contained in:
oblonski 2017-12-14 16:10:17 +01:00
parent f218b9a738
commit cd6477ce14
No known key found for this signature in database
GPG key ID: 179DE487285680D1
3 changed files with 20 additions and 6 deletions

View file

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

View file

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

View file

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