Expose methods for allocating from end to start
FEA: ItEr66S04BugFixing
This commit is contained in:
parent
36b13e9390
commit
621d72508e
4 changed files with 50 additions and 0 deletions
|
|
@ -371,6 +371,12 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
allocations);
|
||||
allocator.allocateUntil(endExclusive);
|
||||
}
|
||||
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
AllocatorForTaskDurationAndSpecifiedResourcesPerDay allocator = new AllocatorForTaskDurationAndSpecifiedResourcesPerDay(
|
||||
allocations);
|
||||
allocator.allocateFromEndUntil(start);
|
||||
}
|
||||
}
|
||||
|
||||
public static HoursAllocationSpecified allocatingHours(
|
||||
|
|
@ -418,6 +424,15 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
}
|
||||
}
|
||||
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
Validate.notNull(start);
|
||||
Validate.isTrue(start.isBefore(task.getEndAsLocalDate()));
|
||||
for (HoursModification each : hoursModifications) {
|
||||
each.allocateFromEndUntil(start);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Task task;
|
||||
|
|
|
|||
|
|
@ -44,4 +44,10 @@ public class AllocatorForTaskDurationAndSpecifiedResourcesPerDay {
|
|||
allocation.applyAllocationUntil(endExclusive);
|
||||
}
|
||||
}
|
||||
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
for (ResourcesPerDayModification allocation : allocations) {
|
||||
allocation.applyAllocationFromEndUntil(start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,13 @@ public abstract class HoursModification extends AllocationModification {
|
|||
.fromStartUntil(end)
|
||||
.allocateHours(getHours());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
genericAllocation.forResources(getResources())
|
||||
.fromEndUntil(start)
|
||||
.allocateHours(getHours());
|
||||
}
|
||||
}
|
||||
|
||||
private static class OnSpecificAllocation extends HoursModification {
|
||||
|
|
@ -71,6 +78,12 @@ public abstract class HoursModification extends AllocationModification {
|
|||
specific.fromStartUntil(end)
|
||||
.allocateHours(getHours());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
specific.fromEndUntil(start)
|
||||
.allocateHours(getHours());
|
||||
}
|
||||
}
|
||||
|
||||
public static HoursModification create(
|
||||
|
|
@ -118,6 +131,8 @@ public abstract class HoursModification extends AllocationModification {
|
|||
|
||||
public abstract void allocateUntil(LocalDate end);
|
||||
|
||||
public abstract void allocateFromEndUntil(LocalDate start);
|
||||
|
||||
public int getHours() {
|
||||
return hours;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,12 @@ public abstract class ResourcesPerDayModification extends
|
|||
.resourcesPerDayUntil(endExclusive).allocate(getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationFromEndUntil(LocalDate start) {
|
||||
genericAllocation.forResources(getResources())
|
||||
.resourcesPerDayFromEndUntil(start).allocate(getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DayAssignment> createAssignmentsAtDay(PartialDay day,
|
||||
EffortDuration limit) {
|
||||
|
|
@ -141,6 +147,12 @@ public abstract class ResourcesPerDayModification extends
|
|||
getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationFromEndUntil(LocalDate start) {
|
||||
resourceAllocation.resourcesPerDayFromEndUntil(start).allocate(
|
||||
getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DayAssignment> createAssignmentsAtDay(PartialDay day,
|
||||
EffortDuration limit) {
|
||||
|
|
@ -238,6 +250,8 @@ public abstract class ResourcesPerDayModification extends
|
|||
|
||||
public abstract void applyAllocationUntil(LocalDate endExclusive);
|
||||
|
||||
public abstract void applyAllocationFromEndUntil(LocalDate start);
|
||||
|
||||
public abstract List<DayAssignment> createAssignmentsAtDay(PartialDay day,
|
||||
EffortDuration limit);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue