Rename method to be consistent with resourcesPerDayFromEndUntil

FEA: ItEr62OTS04PlanificacionHaciaAtras
This commit is contained in:
Óscar González Fernández 2010-11-03 17:02:36 +01:00
parent 3d013b36c5
commit 197e4cfae0
6 changed files with 28 additions and 24 deletions

View file

@ -28,7 +28,7 @@ import org.joda.time.LocalDate;
*/
public interface IAllocatable extends IAllocateResourcesPerDay {
public IAllocateResourcesPerDay until(LocalDate endExclusive);
public IAllocateResourcesPerDay resourcesPerDayUntil(LocalDate endExclusive);
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(LocalDate start);

View file

@ -534,7 +534,7 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
}
@Override
public IAllocateResourcesPerDay until(final LocalDate endExclusive) {
public IAllocateResourcesPerDay resourcesPerDayUntil(final LocalDate endExclusive) {
IntraDayDate startInclusive = getStartAfterConsolidated();
IntraDayDate end = IntraDayDate.startOfDay(endExclusive);
return new AllocateResourcesPerDayOnInterval(startInclusive, end);

View file

@ -161,14 +161,15 @@ public class SpecificResourceAllocation extends
}
@Override
public IAllocateResourcesPerDay until(LocalDate endExclusive) {
return new SpecificAssignmentsAllocation().until(endExclusive);
public IAllocateResourcesPerDay resourcesPerDayUntil(LocalDate endExclusive) {
return new SpecificAssignmentsAllocation()
.resourcesPerDayUntil(endExclusive);
}
@Override
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(LocalDate start) {
return new SpecificAssignmentsAllocation()
.resourcesPerDayFromEndUntil(start);
SpecificAssignmentsAllocation allocator = new SpecificAssignmentsAllocation();
return allocator.resourcesPerDayFromEndUntil(start);
}
@Override

View file

@ -69,8 +69,8 @@ public abstract class ResourcesPerDayModification extends
@Override
public void applyAllocationUntil(LocalDate endExclusive) {
genericAllocation.forResources(getResources()).until(endExclusive)
.allocate(getGoal());
genericAllocation.forResources(getResources())
.resourcesPerDayUntil(endExclusive).allocate(getGoal());
}
@Override
@ -136,7 +136,8 @@ public abstract class ResourcesPerDayModification extends
@Override
public void applyAllocationUntil(LocalDate endExclusive) {
resourceAllocation.until(endExclusive).allocate(getGoal());
resourceAllocation.resourcesPerDayUntil(endExclusive).allocate(
getGoal());
}
@Override

View file

@ -337,7 +337,7 @@ public class GenericResourceAllocationTest {
ResourcesPerDay resourcesPerDay = ResourcesPerDay.amount(1);
genericResourceAllocation.forResources(Arrays.asList(worker1))
.until(start.plusDays(2))
.resourcesPerDayUntil(start.plusDays(2))
.allocate(resourcesPerDay);
List<GenericDayAssignment> orderedAssignmentsFor = genericResourceAllocation
@ -360,8 +360,9 @@ public class GenericResourceAllocationTest {
genericResourceAllocation.forResources(Arrays.asList(worker1))
.allocate(resourcesPerDay);
genericResourceAllocation.forResources(Arrays.asList(worker1)).until(
start.plusDays(2)).allocate(resourcesPerDay);
genericResourceAllocation.forResources(Arrays.asList(worker1))
.resourcesPerDayUntil(start.plusDays(2))
.allocate(resourcesPerDay);
List<GenericDayAssignment> orderedAssignmentsFor = genericResourceAllocation
.getOrderedAssignmentsFor(worker1);
@ -378,8 +379,9 @@ public class GenericResourceAllocationTest {
givenWorkersWithoutLoadAndWithoutCalendar();
ResourcesPerDay resourcesPerDay = ResourcesPerDay.amount(1);
genericResourceAllocation.forResources(Arrays.asList(worker1)).until(
start.minusDays(1)).allocate(resourcesPerDay);
genericResourceAllocation.forResources(Arrays.asList(worker1))
.resourcesPerDayUntil(start.minusDays(1))
.allocate(resourcesPerDay);
}
@Test(expected = IllegalArgumentException.class)
@ -390,8 +392,8 @@ public class GenericResourceAllocationTest {
givenWorkersWithoutLoadAndWithoutCalendar();
ResourcesPerDay resourcesPerDay = ResourcesPerDay.amount(1);
genericResourceAllocation.forResources(Arrays.asList(worker1)).until(
null).allocate(resourcesPerDay);
genericResourceAllocation.forResources(Arrays.asList(worker1))
.resourcesPerDayUntil(null).allocate(resourcesPerDay);
}
@Test
@ -402,8 +404,8 @@ public class GenericResourceAllocationTest {
givenWorkersWithoutLoadAndWithoutCalendar();
ResourcesPerDay resourcesPerDay = ResourcesPerDay.amount(1);
genericResourceAllocation.forResources(Arrays.asList(worker1)).until(
start).allocate(resourcesPerDay);
genericResourceAllocation.forResources(Arrays.asList(worker1))
.resourcesPerDayUntil(start).allocate(resourcesPerDay);
assertThat(genericResourceAllocation.getResourcesPerDay(),
equalTo(ResourcesPerDay.amount(0)));
assertTrue(genericResourceAllocation.getOrderedAssignmentsFor(worker1)

View file

@ -244,8 +244,8 @@ public class SpecificResourceAllocationTest {
public void canAllocateUntilSomeEndDate() {
LocalDate start = new LocalDate(2000, 2, 4);
givenSpecificResourceAllocation(start, 4);
specificResourceAllocation.until(start.plusDays(3)).allocate(
ResourcesPerDay.amount(1));
specificResourceAllocation.resourcesPerDayUntil(start.plusDays(3))
.allocate(ResourcesPerDay.amount(1));
assertThat(specificResourceAllocation.getAssignments(), haveHours(8, 8,
8));
}
@ -445,8 +445,8 @@ public class SpecificResourceAllocationTest {
}
});
givenSpecificResourceAllocation(start, 4);
specificResourceAllocation.until(start.plusDays(4)).allocate(
ResourcesPerDay.amount(1));
specificResourceAllocation.resourcesPerDayUntil(start.plusDays(4))
.allocate(ResourcesPerDay.amount(1));
assertThat(specificResourceAllocation.getResourcesPerDay(),
equalTo(ResourcesPerDay.amount(1)));
}
@ -458,8 +458,8 @@ public class SpecificResourceAllocationTest {
givenResourceCalendarAlwaysReturning(8);
IntraDayDate end = IntraDayDate.startOfDay(start.getDate().plusDays(4));
givenSpecificResourceAllocation(start, end);
specificResourceAllocation.until(end.asExclusiveEnd()).allocate(
ResourcesPerDay.amount(1));
specificResourceAllocation.resourcesPerDayUntil(end.asExclusiveEnd())
.allocate(ResourcesPerDay.amount(1));
assertThat(specificResourceAllocation.getResourcesPerDay(),
equalTo(ResourcesPerDay.amount(1)));
}