ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Adding method to calculate hours between two dates for an aggregate of ResourceAllocation

This commit is contained in:
Óscar González Fernández 2009-10-07 13:14:39 +02:00
parent edb9d0c3d3
commit ae6fc2ba19

View file

@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.Validate;
import org.joda.time.LocalDate;
/**
* Computes aggregate values on a set{@link ResourceAllocation}
@ -72,4 +73,12 @@ public class AggregateOfResourceAllocations {
return ResourceAllocation.sortedByStartDate(result);
}
public int hoursBetween(LocalDate startDate, LocalDate endDate) {
int sum = 0;
for (ResourceAllocation<?> r : resourceAllocations) {
sum += r.getAssignedHours(startDate, endDate);
}
return sum;
}
}