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

Prevent division by zero

refs 3371
parent 6551d9f8
......@@ -6,5 +6,5 @@ ScheduleView.java 3c0165545106c338f3a00449b09b4e219bf94a29 GREEN
ScheduleViewCanvas.java 00f5ab7cac8bf9c14756fe6ebd15c5a7b3bdee18 YELLOW
ScheduleViewColors.java a5544e371ea55d1d6cec99cd119bdddfef3d1239 GREEN
ScheduleViewGraphModel.java 218aadb5dd480a2a0f8ff72ced6bc8816181911d YELLOW
ScheduleViewLayoutData.java c192e6d12806bac9df98c7e25faa45607023bef0 YELLOW
ScheduleViewLayoutData.java e95451d12a58eb40fe722bfc9d5ae79029e8060a YELLOW
ScheduleViewModel.java 5f6a9a99f00ee4bbc8b6e07b60e2cffc0e5ac9bb GREEN
......@@ -79,7 +79,7 @@ public class ScheduleViewLayoutData {
private int scalingUserX = SCALING_USER_X_DEFAULT;
/** Scaling factor (along the x axis) to ensure the required precision. */
private BigDecimal scalingPrecisionX = BigDecimal.ONE;
private BigDecimal scalingPrecisionX = ONE;
/** Height of a single schedule (in diagram space). */
private int diagramHeightOfSchedule;
......@@ -197,7 +197,7 @@ public class ScheduleViewLayoutData {
// - Point_A = (xa, ya) = (1, MAF / #of stripes to be displayed (here: 10);
// - Point_S = (xs, ys) = (minimum) = (SCALING_USER_X_MAX, smallest value);
BigDecimal xs = BigDecimal.valueOf(SCALING_USER_X_MAX);
BigDecimal ys = BigDecimal.ONE.movePointLeft(highestRequiredPrecision);
BigDecimal ys = ONE.movePointLeft(highestRequiredPrecision);
int numberOfHyperPeriods = scheduleModel.getNumberOfHyperPeriods();
BigDecimal objectWidthOfGraph =
......@@ -215,7 +215,7 @@ public class ScheduleViewLayoutData {
modelLabelInterval =
a.multiply(su_x.subtract(xs)).multiply((su_x.subtract(su_x_max))).add(ys);
// ... round it to a "nice" value
modelLabelInterval = roundToNearestQuarterHalfFull(modelLabelInterval);
modelLabelInterval = roundToNearestQuarterHalfFull(modelLabelInterval).max(ONE);
scalingPrecisionX =
valueOf(scheduleWidth).divide(modelLabelInterval.multiply(numLabels),
......
Markdown is supported
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