From aeb7d6fcb730058ab51fae5ca9e2ddaecc660929 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Wed, 6 Jan 2016 10:05:48 -0500 Subject: [PATCH] analysis: fix Loose Coupling and int division to double conversion AbstractSegmentStoreDensityViewer is fixed and made more portable. Change-Id: Ic7ca60aefb308eaa4a00c914cb7dff6b274c4bb7 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/63646 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann --- .../density/AbstractSegmentStoreDensityViewer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java index e5d7913d56..542a5dccfb 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java @@ -141,8 +141,9 @@ public abstract class AbstractSegmentStoreDensityViewer extends TmfViewer { yOrigSeries[(int) xBox]++; minX = Math.min(minX, segment.getLength()); } + double timeWidth = (double) maxLength / (double) width; for (int i = 0; i < width; i++) { - xOrigSeries[i] = i * maxLength / width; + xOrigSeries[i] = i * timeWidth; } double maxY = Double.MIN_VALUE; for (int i = 0; i < width; i++) { @@ -203,7 +204,7 @@ public abstract class AbstractSegmentStoreDensityViewer extends TmfViewer { return CompletableFuture.supplyAsync(() -> computeData(timeRange, durationRange)); } - private @Nullable ArrayList computeData(final TmfTimeRange timeRange, final Range durationRange) { + private @Nullable List computeData(final TmfTimeRange timeRange, final Range durationRange) { final AbstractSegmentStoreAnalysisModule analysisModule = fAnalysisModule; if (analysisModule == null) { return null; -- 2.34.1