Remove resetGenericAssignments method
It was confusing since generic is a name also used in GenericResourceAllocation and GenericDayAssignment. FEA: ItEr60S19TimeUnitDataType
This commit is contained in:
parent
b4e18f2ed8
commit
1131c504c6
2 changed files with 21 additions and 29 deletions
|
|
@ -231,11 +231,10 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setNewDataForAllocation(
|
||||
ResourceAllocation<?> allocation, TaskDate end,
|
||||
ResourcesPerDay resourcesPerDay,
|
||||
List<DayAssignment> dayAssignments) {
|
||||
allocation.resetGenericAssignmentsTo(dayAssignments, end);
|
||||
protected <T extends DayAssignment> void setNewDataForAllocation(
|
||||
ResourceAllocation<T> allocation, TaskDate end,
|
||||
ResourcesPerDay resourcesPerDay, List<T> dayAssignments) {
|
||||
allocation.resetAssignmentsTo(dayAssignments, end);
|
||||
allocation.updateResourcesPerDay();
|
||||
}
|
||||
|
||||
|
|
@ -812,19 +811,6 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
protected abstract ICalendar getCalendarGivenTaskCalendar(
|
||||
ICalendar taskCalendar);
|
||||
|
||||
private void resetGenericAssignmentsTo(List<DayAssignment> assignments,
|
||||
TaskDate end) {
|
||||
resetAssignmentsTo(cast(assignments), end);
|
||||
}
|
||||
|
||||
private List<T> cast(List<DayAssignment> value) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
for (DayAssignment dayAssignment : value) {
|
||||
result.add(getDayAssignmentType().cast(dayAssignment));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected abstract Class<T> getDayAssignmentType();
|
||||
|
||||
public ResourceAllocation<T> copy(Scenario scenario) {
|
||||
|
|
|
|||
|
|
@ -110,20 +110,26 @@ public abstract class AllocatorForSpecifiedResourcesPerDayAndHours {
|
|||
private void setAssignmentsForEachAllocation(TaskDate end) {
|
||||
for (Entry<ResourcesPerDayModification, List<DayAssignment>> entry : resultAssignments
|
||||
.entrySet()) {
|
||||
ResourceAllocation<?> allocation = entry.getKey()
|
||||
.getBeingModified();
|
||||
ResourcesPerDay resourcesPerDay = entry.getKey()
|
||||
.getGoal();
|
||||
List<DayAssignment> value = entry.getValue();
|
||||
setNewDataForAllocation(allocation, end, resourcesPerDay,
|
||||
value);
|
||||
setNewDataForAllocation(entry, end);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void setNewDataForAllocation(
|
||||
ResourceAllocation<?> allocation, TaskDate explicitEnd,
|
||||
ResourcesPerDay resourcesPerDay,
|
||||
List<DayAssignment> dayAssignments);
|
||||
private <T extends DayAssignment> void setNewDataForAllocation(
|
||||
Entry<ResourcesPerDayModification, List<DayAssignment>> entry,
|
||||
TaskDate end) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ResourceAllocation<T> allocation = (ResourceAllocation<T>) entry
|
||||
.getKey().getBeingModified();
|
||||
ResourcesPerDay resourcesPerDay = entry.getKey().getGoal();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<T> value = (List<T>) entry.getValue();
|
||||
setNewDataForAllocation(allocation, end, resourcesPerDay,
|
||||
value);
|
||||
}
|
||||
|
||||
protected abstract <T extends DayAssignment> void setNewDataForAllocation(
|
||||
ResourceAllocation<T> allocation, TaskDate explicitEnd,
|
||||
ResourcesPerDay resourcesPerDay, List<T> dayAssignments);
|
||||
|
||||
protected abstract List<DayAssignment> createAssignmentsAtDay(
|
||||
ResourcesPerDayModification allocation, LocalDate day,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue