Rename onInterval method
The new method, onIntervalWithinTask, reflects much better the meaning. FEA: ItEr70S04BugFixing
This commit is contained in:
parent
6d1bddbafc
commit
d1896093fa
11 changed files with 39 additions and 39 deletions
|
|
@ -50,7 +50,7 @@ public interface IAllocatable extends IAllocateResourcesPerDay {
|
|||
* @return an object which can be used to allocate hours on the interval
|
||||
* specified
|
||||
*/
|
||||
public IAllocateHoursOnInterval onInterval(LocalDate startInclusive,
|
||||
public IAllocateHoursOnInterval onIntervalWithinTask(LocalDate startInclusive,
|
||||
LocalDate endExclusive);
|
||||
|
||||
public IAllocateHoursOnInterval fromStartUntil(LocalDate endExclusive);
|
||||
|
|
|
|||
|
|
@ -696,7 +696,7 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAllocateHoursOnInterval onInterval(LocalDate start,
|
||||
public IAllocateHoursOnInterval onIntervalWithinTask(LocalDate start,
|
||||
LocalDate end) {
|
||||
return new AllocateHoursOnInterval(start, end);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class SigmoidFunction extends AssignmentFunction {
|
|||
LocalDate day, int hours) {
|
||||
final LocalDate nextDay = day.plusDays(1);
|
||||
resourceAllocation.withPreviousAssociatedResources()
|
||||
.onInterval(day, nextDay).allocateHours(hours);
|
||||
.onIntervalWithinTask(day, nextDay).allocateHours(hours);
|
||||
}
|
||||
|
||||
private BigDecimal[] roundValues(BigDecimal[] allocatedHoursPerDay,
|
||||
|
|
|
|||
|
|
@ -203,8 +203,8 @@ public class SpecificResourceAllocation extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAllocateHoursOnInterval onInterval(LocalDate start, LocalDate end) {
|
||||
return new SpecificAssignmentsAllocator().onInterval(start, end);
|
||||
public IAllocateHoursOnInterval onIntervalWithinTask(LocalDate start, LocalDate end) {
|
||||
return new SpecificAssignmentsAllocator().onIntervalWithinTask(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
LocalDate day = startInclusive.plusDays(i);
|
||||
LocalDate nextDay = day.plusDays(1);
|
||||
allocation.withPreviousAssociatedResources()
|
||||
.onInterval(day, nextDay)
|
||||
.onIntervalWithinTask(day, nextDay)
|
||||
.allocateHours(hoursForEachDay[i]);
|
||||
reallyAssigned[i] = allocation.getAssignedHours(day,
|
||||
nextDay);
|
||||
|
|
@ -113,7 +113,7 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
LocalDate day = startInclusive.plusDays(i);
|
||||
LocalDate nextDay = day.plusDays(1);
|
||||
allocation.withPreviousAssociatedResources()
|
||||
.onInterval(day, nextDay)
|
||||
.onIntervalWithinTask(day, nextDay)
|
||||
.allocateHours(newHours);
|
||||
}
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
LocalDate startInclusive, LocalDate endExclusive,
|
||||
int intervalHours) {
|
||||
resourceAllocation.withPreviousAssociatedResources()
|
||||
.onInterval(getStartFor(startInclusive),
|
||||
.onIntervalWithinTask(getStartFor(startInclusive),
|
||||
getEnd())
|
||||
.allocateHours(intervalHours);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ public class TaskElementDAOTest {
|
|||
LocalDate start = task.getStartAsLocalDate();
|
||||
task.setIntraDayEndDate(IntraDayDate.startOfDay(start
|
||||
.plusDays(2)));
|
||||
allocation.onInterval(start, start.plusDays(2)).allocateHours(16);
|
||||
allocation.onIntervalWithinTask(start, start.plusDays(2)).allocateHours(16);
|
||||
assertTrue(allocation.getAssignedHours() > 0);
|
||||
|
||||
task.addResourceAllocation(allocation);
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ public class GenericResourceAllocationTest {
|
|||
|
||||
final int hoursOnSubinterval = 3;
|
||||
int daysSubinterval = 2;
|
||||
genericResourceAllocation.forResources(workers).onInterval(start,
|
||||
genericResourceAllocation.forResources(workers).onIntervalWithinTask(start,
|
||||
start.plusDays(daysSubinterval)).allocateHours(
|
||||
hoursOnSubinterval);
|
||||
assertThat(genericResourceAllocation.getAssignedHours(),
|
||||
|
|
@ -661,7 +661,7 @@ public class GenericResourceAllocationTest {
|
|||
|
||||
final int hoursOnSubinterval = 3;
|
||||
int daysSubinterval = 2;
|
||||
genericResourceAllocation.withPreviousAssociatedResources().onInterval(
|
||||
genericResourceAllocation.withPreviousAssociatedResources().onIntervalWithinTask(
|
||||
start,
|
||||
start.plusDays(daysSubinterval)).allocateHours(
|
||||
hoursOnSubinterval);
|
||||
|
|
@ -699,7 +699,7 @@ public class GenericResourceAllocationTest {
|
|||
ResourcesPerDay.amount(3));
|
||||
ResourcesPerDay original = genericResourceAllocation
|
||||
.getResourcesPerDay();
|
||||
genericResourceAllocation.forResources(workers).onInterval(start,
|
||||
genericResourceAllocation.forResources(workers).onIntervalWithinTask(start,
|
||||
start.plusDays(2)).allocateHours(60);
|
||||
ResourcesPerDay current = genericResourceAllocation
|
||||
.getResourcesPerDay();
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ public class SpecificResourceAllocationTest {
|
|||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
LocalDate dayBefore = start.plusDays(-1);
|
||||
specificResourceAllocation.onInterval(start, dayBefore).allocateHours(
|
||||
specificResourceAllocation.onIntervalWithinTask(start, dayBefore).allocateHours(
|
||||
10);
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void canAllocateZeroHours() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(0);
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void cantAllocateNegativeHours() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(1))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(1))
|
||||
.allocateHours(-1);
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void someHoursInAnIntervalCanBeAssigned() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
assertThat(specificResourceAllocation.getAssignments(), haveHours(5, 5));
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void thePartOfTheIntervalUsedIsTheOneOverlapping() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start.plusDays(1),
|
||||
specificResourceAllocation.onIntervalWithinTask(start.plusDays(1),
|
||||
start.plusDays(6)).allocateHours(12);
|
||||
assertThat(specificResourceAllocation.getAssignments(),
|
||||
haveHours(4, 4, 4));
|
||||
|
|
@ -331,7 +331,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void ifTheProvidedIntervalIsAfterTheTaskDoesntAllocateAnything() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start.plusDays(5),
|
||||
specificResourceAllocation.onIntervalWithinTask(start.plusDays(5),
|
||||
start.plusDays(6)).allocateHours(12);
|
||||
assertTrue(specificResourceAllocation.getAssignments().isEmpty());
|
||||
}
|
||||
|
|
@ -340,7 +340,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void ifTheProvidedIntervalIsBeforeTheTaskDoesntAllocateAnything() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start.minusDays(5),
|
||||
specificResourceAllocation.onIntervalWithinTask(start.minusDays(5),
|
||||
start.minusDays(2)).allocateHours(12);
|
||||
assertTrue(specificResourceAllocation.getAssignments().isEmpty());
|
||||
}
|
||||
|
|
@ -352,7 +352,7 @@ public class SpecificResourceAllocationTest {
|
|||
|
||||
specificResourceAllocation.fromStartUntil(start.plusDays(2))
|
||||
.allocateHours(16);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(6))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(6))
|
||||
.allocateHours(12);
|
||||
|
||||
assertThat(specificResourceAllocation.getAssignments(),
|
||||
|
|
@ -366,7 +366,7 @@ public class SpecificResourceAllocationTest {
|
|||
LocalDate end = start.plusDays(4);
|
||||
|
||||
specificResourceAllocation.fromStartUntil(end).allocateHours(32);
|
||||
specificResourceAllocation.onInterval(start.plusDays(3), end)
|
||||
specificResourceAllocation.onIntervalWithinTask(start.plusDays(3), end)
|
||||
.allocateHours(0);
|
||||
|
||||
assertThat(specificResourceAllocation.getIntraDayEndDate(),
|
||||
|
|
@ -384,7 +384,7 @@ public class SpecificResourceAllocationTest {
|
|||
assertThat(specificResourceAllocation.getIntraDayEndDate(),
|
||||
equalTo(IntraDayDate.startOfDay(end.minusDays(1))));
|
||||
|
||||
specificResourceAllocation.onInterval(start, end).allocateHours(32);
|
||||
specificResourceAllocation.onIntervalWithinTask(start, end).allocateHours(32);
|
||||
assertThat(specificResourceAllocation.getAssignments(),
|
||||
haveHours(8, 8, 8, 8));
|
||||
assertThat(specificResourceAllocation.getIntraDayEndDate(),
|
||||
|
|
@ -397,7 +397,7 @@ public class SpecificResourceAllocationTest {
|
|||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.fromStartUntil(start.plusDays(4))
|
||||
.allocateHours(32);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(1))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(1))
|
||||
.allocateHours(0);
|
||||
assertThat(specificResourceAllocation.getIntraDayStartDate(),
|
||||
equalTo(IntraDayDate.startOfDay(start)));
|
||||
|
|
@ -442,7 +442,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void canBeNotifiedWhenADayAssignmentIsRemoved() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
List<SpecificDayAssignment> currentAssignments = specificResourceAllocation
|
||||
.getAssignments();
|
||||
|
|
@ -455,7 +455,7 @@ public class SpecificResourceAllocationTest {
|
|||
specificResourceAllocation
|
||||
.setOnDayAssignmentRemoval(dayAssignmentRemovalMock);
|
||||
replay(dayAssignmentRemovalMock);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
verify(dayAssignmentRemovalMock);
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ public class SpecificResourceAllocationTest {
|
|||
public void canAutomaticallyDetachDayAssignmentsWhenRemoved() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
List<SpecificDayAssignment> assignments = specificResourceAllocation
|
||||
.getAssignments();
|
||||
|
|
@ -474,7 +474,7 @@ public class SpecificResourceAllocationTest {
|
|||
|
||||
specificResourceAllocation
|
||||
.setOnDayAssignmentRemoval(new DetachDayAssignmentOnRemoval());
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
|
||||
for (SpecificDayAssignment each : assignments) {
|
||||
|
|
@ -488,7 +488,7 @@ public class SpecificResourceAllocationTest {
|
|||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.allocate(ResourcesPerDay.amount(1));
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
assertThat(specificResourceAllocation.getAssignments(), haveHours(5, 5,
|
||||
3, 3));
|
||||
|
|
@ -500,7 +500,7 @@ public class SpecificResourceAllocationTest {
|
|||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.allocate(ResourcesPerDay.amount(1));
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(0);
|
||||
assertThat(specificResourceAllocation.getAssignments(), from(start
|
||||
.plusDays(2)));
|
||||
|
|
@ -513,7 +513,7 @@ public class SpecificResourceAllocationTest {
|
|||
givenSpecificResourceAllocation(start, 4);
|
||||
ResourcesPerDay original = ResourcesPerDay.amount(1);
|
||||
specificResourceAllocation.allocate(original);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
ResourcesPerDay newResourcesPerDay = specificResourceAllocation
|
||||
.getResourcesPerDay();
|
||||
|
|
@ -560,7 +560,7 @@ public class SpecificResourceAllocationTest {
|
|||
}
|
||||
});
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(2))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(2))
|
||||
.allocateHours(10);
|
||||
assertThat(specificResourceAllocation.getAssignments(), haveHours(2, 8));
|
||||
}
|
||||
|
|
@ -577,7 +577,7 @@ public class SpecificResourceAllocationTest {
|
|||
}
|
||||
});
|
||||
givenSpecificResourceAllocation(start, 4);
|
||||
specificResourceAllocation.onInterval(start, start.plusDays(4))
|
||||
specificResourceAllocation.onIntervalWithinTask(start, start.plusDays(4))
|
||||
.allocateHours(20);
|
||||
assertThat(specificResourceAllocation.getAssignments(), haveHours(2, 4,
|
||||
8, 6));
|
||||
|
|
|
|||
|
|
@ -288,14 +288,14 @@ public class UntilFillingHoursAllocatorTest {
|
|||
.get(0)
|
||||
.getBeingModified();
|
||||
// hours per day: 8, 8, 8, 6
|
||||
allocation.onInterval(startDate.getDate(),
|
||||
allocation.onIntervalWithinTask(startDate.getDate(),
|
||||
startDate.getDate().plusDays(1))
|
||||
.allocateHours(6);
|
||||
// hours per day: 6, 8, 8, 6
|
||||
assertTrue(allocation.getResourcesPerDay().getAmount()
|
||||
.compareTo(oneResourcePerDay.getAmount()) < 0);
|
||||
|
||||
allocation.onInterval(startDate.getDate().plusDays(3),
|
||||
allocation.onIntervalWithinTask(startDate.getDate().plusDays(3),
|
||||
startDate.getDate().plusDays(4)).allocateHours(8);
|
||||
// hours per day: 6, 8, 8, 8
|
||||
assertThat(allocation.getResourcesPerDay(), equalTo(oneResourcePerDay));
|
||||
|
|
@ -304,7 +304,7 @@ public class UntilFillingHoursAllocatorTest {
|
|||
// the user and then the real values. In the meantime doing an effort to
|
||||
// keep the original value
|
||||
|
||||
allocation.onInterval(startDate.getDate().plusDays(4),
|
||||
allocation.onIntervalWithinTask(startDate.getDate().plusDays(4),
|
||||
startDate.getDate().plusDays(5))
|
||||
.allocateHours(8);
|
||||
// hours per day: 6, 8, 8, 8, 8
|
||||
|
|
@ -312,7 +312,7 @@ public class UntilFillingHoursAllocatorTest {
|
|||
.compareTo(oneResourcePerDay.getAmount()) < 0);
|
||||
|
||||
// hours per day: 6, 8, 8, 8, 10
|
||||
allocation.onInterval(startDate.getDate().plusDays(4),
|
||||
allocation.onIntervalWithinTask(startDate.getDate().plusDays(4),
|
||||
startDate.getDate().plusDays(5))
|
||||
.allocateHours(10);
|
||||
assertThat(allocation.getResourcesPerDay(), equalTo(oneResourcePerDay));
|
||||
|
|
|
|||
|
|
@ -1173,7 +1173,7 @@ class Row {
|
|||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Integer value = intbox.getValue();
|
||||
getAllocation().withPreviousAssociatedResources().onInterval(
|
||||
getAllocation().withPreviousAssociatedResources().onIntervalWithinTask(
|
||||
getAllocation().getStartDate(),
|
||||
getAllocation().getEndDate())
|
||||
.allocateHours(value);
|
||||
|
|
@ -1550,7 +1550,7 @@ class Row {
|
|||
LocalDate endDate = restriction.limitEndDate(item.getEndDate()
|
||||
.toLocalDate());
|
||||
getAllocation().withPreviousAssociatedResources()
|
||||
.onInterval(startDate, endDate)
|
||||
.onIntervalWithinTask(startDate, endDate)
|
||||
.allocateHours(value);
|
||||
fireCellChanged(item);
|
||||
intbox.setRawValue(getHoursForDetailItem(item));
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
.allocateKeepingProportions(startInclusive, endExclusive,
|
||||
pendingHours);
|
||||
} else {
|
||||
resourceAllocation.withPreviousAssociatedResources().onInterval(
|
||||
resourceAllocation.withPreviousAssociatedResources().onIntervalWithinTask(
|
||||
startInclusive, endExclusive).allocateHours(pendingHours);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue