|
|
@@ -5,7 +5,7 @@ import java.util.HashSet;
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
public class PlanningInput {
|
|
|
- private ArrayList<VolonteerRaw> volonteerList;
|
|
|
+ private ArrayList<VolunteerRaw> volonteerList;
|
|
|
|
|
|
private ArrayList<MealSlot> mealSlots;
|
|
|
|
|
|
@@ -20,7 +20,7 @@ public class PlanningInput {
|
|
|
private int currentMaxId = 1;
|
|
|
|
|
|
public PlanningInput() {
|
|
|
- this.volonteerList = new ArrayList<VolonteerRaw>();
|
|
|
+ this.volonteerList = new ArrayList<VolunteerRaw>();
|
|
|
this.mealSlots = new ArrayList<MealSlot>();
|
|
|
this.timeslots = new ArrayList<TimeslotRaw>();
|
|
|
this.assignements = new ArrayList<AssignementPair>();
|
|
|
@@ -28,7 +28,7 @@ public class PlanningInput {
|
|
|
this.constraints = new ArrayList<Skill>();
|
|
|
}
|
|
|
|
|
|
- public PlanningInput(ArrayList<VolonteerRaw> volonteerList, ArrayList<MealSlot> mealSlots,
|
|
|
+ public PlanningInput(ArrayList<VolunteerRaw> volonteerList, ArrayList<MealSlot> mealSlots,
|
|
|
ArrayList<TimeslotRaw> timeslots, ArrayList<AssignementPair> assignements,
|
|
|
ArrayList<AssignementPair> mealAssignements) {
|
|
|
this.volonteerList = volonteerList;
|
|
|
@@ -56,8 +56,8 @@ public class PlanningInput {
|
|
|
}
|
|
|
|
|
|
private ArrayList<MealAssignement> addMissingMealAssigment(
|
|
|
- ArrayList<MealAssignement> mealAssignements, ArrayList<Volonteer> volonteerList) {
|
|
|
- for (Volonteer volonteer : volonteerList) {
|
|
|
+ ArrayList<MealAssignement> mealAssignements, ArrayList<Volunteer> volonteerList) {
|
|
|
+ for (Volunteer volonteer : volonteerList) {
|
|
|
Long missingAssignementCount = 1 - mealAssignements.stream()
|
|
|
.filter(predicate -> predicate.getVolonteer().getId().equals(volonteer.getId())).count();
|
|
|
while (missingAssignementCount > 0) {
|
|
|
@@ -97,9 +97,9 @@ public class PlanningInput {
|
|
|
return output;
|
|
|
}
|
|
|
|
|
|
- private ArrayList<Volonteer> getMappedVolonteers(HashMap<Integer, Skill> skillsMap) {
|
|
|
- ArrayList<Volonteer> output = new ArrayList<Volonteer>();
|
|
|
- for (VolonteerRaw volonteerRaw : volonteerList) {
|
|
|
+ private ArrayList<Volunteer> getMappedVolonteers(HashMap<Integer, Skill> skillsMap) {
|
|
|
+ ArrayList<Volunteer> output = new ArrayList<Volunteer>();
|
|
|
+ for (VolunteerRaw volonteerRaw : volonteerList) {
|
|
|
HashSet<Skill> competencies = new HashSet<Skill>();
|
|
|
HashSet<Skill> preferences = new HashSet<Skill>();
|
|
|
|
|
|
@@ -111,7 +111,7 @@ public class PlanningInput {
|
|
|
competencies.add(e);
|
|
|
}
|
|
|
}
|
|
|
- output.add(new Volonteer(volonteerRaw.getId(), competencies, preferences));
|
|
|
+ output.add(new Volunteer(volonteerRaw.getId(), competencies, preferences));
|
|
|
}
|
|
|
return output;
|
|
|
}
|
|
|
@@ -135,14 +135,14 @@ public class PlanningInput {
|
|
|
}
|
|
|
|
|
|
// Map skills to volonteer
|
|
|
- ArrayList<Volonteer> volonteerList = this.getMappedVolonteers(skillMap);
|
|
|
+ ArrayList<Volunteer> volonteerList = this.getMappedVolonteers(skillMap);
|
|
|
|
|
|
// Create skills map
|
|
|
- HashMap<Long, Volonteer> volonteerMap = new HashMap<Long, Volonteer>();
|
|
|
- for (Volonteer v : volonteerList) {
|
|
|
+ HashMap<Long, Volunteer> volonteerMap = new HashMap<Long, Volunteer>();
|
|
|
+ for (Volunteer v : volonteerList) {
|
|
|
volonteerMap.put(v.getId(), v);
|
|
|
}
|
|
|
- Volonteer volonteer;
|
|
|
+ Volunteer volonteer;
|
|
|
Timeslot timeslot;
|
|
|
// Create Assignements Objects
|
|
|
ArrayList<Assignement> assignements = new ArrayList<Assignement>();
|
|
|
@@ -201,11 +201,11 @@ public class PlanningInput {
|
|
|
// ********************************
|
|
|
// Getters and setters
|
|
|
// ********************************
|
|
|
- public ArrayList<VolonteerRaw> getVolonteerList() {
|
|
|
+ public ArrayList<VolunteerRaw> getVolonteerList() {
|
|
|
return this.volonteerList;
|
|
|
}
|
|
|
|
|
|
- public void setVolonteerList(ArrayList<VolonteerRaw> volonteerList) {
|
|
|
+ public void setVolonteerList(ArrayList<VolunteerRaw> volonteerList) {
|
|
|
this.volonteerList = volonteerList;
|
|
|
}
|
|
|
|