From 0cf1f3ebff824742a89c17d4b09e043872532d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Sun, 27 Jun 2010 19:48:50 +0200 Subject: [PATCH] ItEr60S08CUAsignacionRecursosLimitantesItEr59S08: Refactor. Only the allocation is needed so the parameter list reduced to one parameter. Also renamed to reflect better meaning. --- .../LimitingResourceQueueModel.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourceQueueModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourceQueueModel.java index ff1d795c6..ac9df4017 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourceQueueModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourceQueueModel.java @@ -408,7 +408,7 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel { AllocationAttempt allocation = requirements .guessValidity(eachSubGap); if (allocation.isValid()) { - doAllocation(requirements, allocation, eachSubGap.getOriginQueue()); + applyAllocation(allocation); return allocation; } } @@ -424,21 +424,21 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel { return Collections.singletonList(each); } - private void doAllocation(InsertionRequirements requirements, - AllocationAttempt allocation, LimitingResourceQueue queue) { + private void applyAllocation(AllocationAttempt allocationStillNotDone) { + LimitingResourceQueueElement element = allocationStillNotDone + .getElement(); + LimitingResourceQueue queue = allocationStillNotDone.getQueue(); Resource resource = queue.getResource(); - ResourceAllocation resourceAllocation = requirements - .getElement().getResourceAllocation(); - List assignments = allocation + ResourceAllocation resourceAllocation = element.getResourceAllocation(); + List assignments = allocationStillNotDone .getAssignmentsFor(resourceAllocation, resource); resourceAllocation .allocateLimitingDayAssignments(assignments); - updateStartAndEndTimes(requirements.getElement(), - allocation.getStartInclusive(), allocation + updateStartAndEndTimes(element, allocationStillNotDone + .getStartInclusive(), allocationStillNotDone .getEndExclusive()); - addLimitingResourceQueueElement(queue, requirements - .getElement()); - markAsModified(requirements.getElement()); + addLimitingResourceQueueElement(queue, element); + markAsModified(element); } private DateAndHour getEndsAfterBecauseOfGantt(