duration = Duration.standardHours(1);
}
// check interval at next half hour
DateTime firstTimeslot = getNextHalfHour();
Interval test = new Interval(firstTimeslot, firstTimeslot.plus(duration));
testInterval(infeasible, preferred, test, solutions);
// loop over all infeasible intervals
for (Interval i : infeasible) {
// test timeslot left from the infeasible interval
test = new Interval(i.getStart().minus(duration), i.getStart());
testInterval(infeasible, preferred, test, solutions);
// test timeslot right from the infeasible interval
test = new Interval(i.getEnd(), i.getEnd().plus(duration));
testInterval(infeasible, preferred, test, solutions);
}
// loop over all preferred intervals
for (Weight w : preferred) {
// test timeslot left from the start of the preferred interval
test = new Interval(w.getStart().minus(duration), w.getStart());
testInterval(infeasible, preferred, test, solutions);
// test timeslot right from the start of the preferred interval
test = new Interval(w.getStart(), w.getStart().plus(duration));
testInterval(infeasible, preferred, test, solutions);
// test timeslot left from the end of the preferred interval
test = new Interval(w.getEnd().minus(duration), w.getEnd());
testInterval(infeasible, preferred, test, solutions);
// test timeslot right from the end of the preferred interval
test = new Interval(w.getEnd(), w.getEnd().plus(duration));
testInterval(infeasible, preferred, test, solutions);
}
// order the calculated feasible timeslots by weight, from highest to
// lowest. In case of equals weights, the timeslots are ordered by