ItEr59S08CUAsignacionRecursosLimitantesItEr58S10: Move method to getCriteria to LimitingResourceQueueElement.
This commit is contained in:
parent
629edba772
commit
1f0ab46fd4
2 changed files with 19 additions and 9 deletions
|
|
@ -109,7 +109,7 @@ public class LimitingResourceAllocator {
|
|||
result.add(gap);
|
||||
} else if (isGeneric(element)) {
|
||||
final List<Gap> gaps = gap.splitIntoGapsSatisfyingCriteria(
|
||||
resource, getCriteria(element));
|
||||
resource, element.getCriteria());
|
||||
for (Gap subgap : gaps) {
|
||||
if (subgap.canFit(element)) {
|
||||
result.add(subgap);
|
||||
|
|
@ -185,14 +185,6 @@ public class LimitingResourceAllocator {
|
|||
return element.getResourceAllocation() instanceof SpecificResourceAllocation;
|
||||
}
|
||||
|
||||
private static Set<Criterion> getCriteria(LimitingResourceQueueElement element) {
|
||||
final ResourceAllocation<?> resourceAllocation = element.getResourceAllocation();
|
||||
if (resourceAllocation instanceof GenericResourceAllocation) {
|
||||
return ((GenericResourceAllocation) resourceAllocation).getCriterions();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DateAndHour getFirstElementTime(List<DayAssignment> dayAssignments) {
|
||||
final DayAssignment start = dayAssignments.get(0);
|
||||
return new DateAndHour(start.getDay(), start.getHours());
|
||||
|
|
|
|||
|
|
@ -30,8 +30,10 @@ import org.apache.commons.lang.Validate;
|
|||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.planner.entities.Dependency;
|
||||
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.LimitingResourceQueue;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
||||
|
|
@ -244,4 +246,20 @@ public class LimitingResourceQueueElement extends BaseEntity {
|
|||
setEndHour(0);
|
||||
getResourceAllocation().removeLimitingDayAssignments();
|
||||
}
|
||||
|
||||
public boolean isSpecific() {
|
||||
return resourceAllocation instanceof SpecificResourceAllocation;
|
||||
}
|
||||
|
||||
public boolean isGeneric() {
|
||||
return resourceAllocation instanceof GenericResourceAllocation;
|
||||
}
|
||||
|
||||
public Set<Criterion> getCriteria() {
|
||||
if (!isGeneric()) {
|
||||
throw new IllegalStateException("this is not a generic element");
|
||||
}
|
||||
final ResourceAllocation<?> resourceAllocation = getResourceAllocation();
|
||||
return ((GenericResourceAllocation) resourceAllocation).getCriterions();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue