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:
parent
f218b9a738
commit
cd6477ce14
3 changed files with 20 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue