Bug #1409: Rename RelatedWithAnyOf to RelatedWith

Now the constructor only receives one criterion.

FEA: ItEr76S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2012-04-17 13:24:53 +02:00
parent ddf79bde1f
commit 5c608c9a4a
2 changed files with 7 additions and 9 deletions

View file

@ -1133,14 +1133,13 @@ public class PlanningStateCreator {
}
}
public static class RelatedWithAnyOf implements
public static class RelatedWith implements
IAllocationCriteria {
private final Collection<? extends Criterion> anyOf;
private final Criterion criterion;
public RelatedWithAnyOf(
Collection<? extends Criterion> anyOf) {
this.anyOf = anyOf;
public RelatedWith(Criterion criterion) {
this.criterion = criterion;
}
@Override
@ -1156,7 +1155,7 @@ public class PlanningStateCreator {
private boolean someCriterionIn(
Collection<? extends Criterion> allocationCriterions) {
for (Criterion each : allocationCriterions) {
if (this.anyOf.contains(each)) {
if (criterion.equals(each)) {
return true;
}
}

View file

@ -26,7 +26,6 @@ import static org.libreplan.web.I18nHelper._;
import static org.libreplan.web.planner.order.PlanningStateCreator.and;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@ -74,7 +73,7 @@ import org.libreplan.business.users.entities.UserRole;
import org.libreplan.web.calendars.BaseCalendarModel;
import org.libreplan.web.planner.order.PlanningStateCreator.IAllocationCriteria;
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
import org.libreplan.web.planner.order.PlanningStateCreator.RelatedWithAnyOf;
import org.libreplan.web.planner.order.PlanningStateCreator.RelatedWith;
import org.libreplan.web.planner.order.PlanningStateCreator.RelatedWithResource;
import org.libreplan.web.planner.order.PlanningStateCreator.SpecificRelatedWithCriterionOnInterval;
import org.libreplan.web.planner.order.PlanningStateCreator.TaskOnInterval;
@ -506,7 +505,7 @@ public class ResourceLoadModel implements IResourceLoadModel {
for (Entry<Criterion, List<GenericResourceAllocation>> each : map
.entrySet()) {
IAllocationCriteria criteria = and(onInterval(),
new RelatedWithAnyOf(Arrays.asList(each.getKey())));
new RelatedWith(each.getKey()));
List<ResourceAllocation<?>> replaced = parameters
.getPlanningState().replaceByCurrentOnes(
each.getValue(), criteria);