this.calendar = generateCalendarFor(resource);
}
ResourceWithAvailableCapacity withAvailableCapacityOn(PartialDay day,
IAssignedEffortForResource assignedEffort) {
EffortDuration allCapacityForDay = calendar
.getCapacityOn(PartialDay.wholeDay(day.getDate()));
EffortDuration capacity = calendar.getCapacityOn(day);
EffortDuration capacityForAlreadyAssigned = allCapacityForDay
.minus(capacity);
EffortDuration assigned = assignedEffort.getAssignedDurationAt(
resource, day.getDate());
EffortDuration assignedInterfering = assigned.minus(min(assigned,
capacityForAlreadyAssigned));
EffortDuration available = capacity.minus(min(assignedInterfering,
capacity));
return new ResourceWithAvailableCapacity(resource, available);
}