Commit ec1e844f authored by Simon Barner's avatar Simon Barner
Browse files

- Active workaround for "null" ResourceSchedule hyperperiod

parent 603c2bb5
......@@ -26,12 +26,15 @@ import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleModelElementToD
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleModelElementToDraw.drawScheduleModelElement;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewColors.getColor;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.DIAGRAM_OFFSET_Y;
import static org.fortiss.af3.schedule.utils.MathUtils.lcmBigDecimalCollection;
import static org.fortiss.af3.schedule.utils.ScheduleUtils.TOLERANCE;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.SWT;
......@@ -133,14 +136,15 @@ public class ScheduleViewGraphModel {
BigDecimal roundOffset = BigDecimal.ZERO;
BigDecimal schedulePeriod = ScheduleUtils.getHyperPeriod(schedule);
// if(schedulePeriod == null) {
// schedulePeriod =
// lcmBigDecimalCollection(
// schedule.getResourceAllocationList().stream()
// .map(r -> ScheduleUtils.getPeriod(r))
// .filter(p -> p != null).collect(Collectors.toList()),
// TOLERANCE);
// }
// TODO Check whether to remove this workaround
if(schedulePeriod == null) {
schedulePeriod =
lcmBigDecimalCollection(
schedule.getResourceAllocationList().stream()
.map(r -> ScheduleUtils.getPeriod(r))
.filter(p -> p != null).collect(Collectors.toList()),
TOLERANCE);
}
if(schedulePeriod != null && schedulePeriod.compareTo(BigDecimal.ZERO) == 1) {
while(roundOffset.compareTo(scheduleModel.getMajorFrame()) == -1) {
for(ResourceAllocation resourceAllocation : schedule
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment