EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation]

COVERAGE SUMMARY FOR SOURCE FILE [JFreeChartCDFViewer.java]

nameclass, %method, %block, %line, %
JFreeChartCDFViewer.java0%   (0/1)0%   (0/6)0%   (0/146)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JFreeChartCDFViewer0%   (0/1)0%   (0/6)0%   (0/146)0%   (0/30)
JFreeChartCDFViewer (Composite, int): void 0%   (0/1)0%   (0/5)0%   (0/2)
addHistogram (Histogram): void 0%   (0/1)0%   (0/41)0%   (0/9)
computeDensities (Histogram): XYSeries 0%   (0/1)0%   (0/50)0%   (0/9)
getSeries (): XYSeries 0%   (0/1)0%   (0/5)0%   (0/1)
initChart (): void 0%   (0/1)0%   (0/29)0%   (0/5)
initializeContextMenu (MenuManager): void 0%   (0/1)0%   (0/16)0%   (0/4)

1package de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation;
2 
3import java.awt.BasicStroke;
4 
5import org.eclipse.jface.action.MenuManager;
6import org.eclipse.swt.widgets.Composite;
7import org.jfree.chart.ChartFactory;
8import org.jfree.chart.plot.PlotOrientation;
9import org.jfree.chart.plot.XYPlot;
10import org.jfree.data.xy.XYSeries;
11 
12import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.Histogram;
13import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.HistogramBucketInformation;
14 
15 
16public class JFreeChartCDFViewer extends AbstractJFreeChartWidthViewer implements IHistogramAccepter, ISeriesExporter {
17 
18        public XYSeries getSeries() {
19                return densityDataset.getSeries(0);
20        }
21 
22        public JFreeChartCDFViewer(Composite parent, int style) {
23                super(parent, style);
24        }
25 
26        @Override
27        protected void initializeContextMenu(MenuManager menu_manager) {
28                super.initializeContextMenu(menu_manager);
29            menu_manager.add(new LoadCSVHistogram(this));
30            menu_manager.add(new ExportCSV(this));
31        }
32 
33        /* (non-Javadoc)
34         * @see de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation.IHistogramAccepter#addHistogram(de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.Histogram)
35         */
36        public void addHistogram(Histogram histogram) {
37                XYSeries density = new XYSeries(histogram.getTitle(),true,false);
38                double sum = 0;
39                for (HistogramBucketInformation e : histogram.getBucketInformation()) {
40                        sum += e.getProbability();
41                        density.add(e.getValue(), sum);
42                }
43                densityDataset.addSeries(density);
44                initChart();
45                this.redraw();
46        }
47 
48 
49        @SuppressWarnings("deprecation")
50        protected void initChart() {
51                chart = ChartFactory.createXYLineChart("Cumulative Distribution Function", "Time", "Probability", densityDataset, PlotOrientation.VERTICAL, true, true, true);
52                XYPlot plot = (XYPlot)chart.getPlot();
53                
54                plot.getRangeAxis().setAutoRange(true);
55                plot.getRenderer().setStroke(new BasicStroke(3));
56        }
57        
58        protected XYSeries computeDensities(Histogram hist) {
59                double sum = 0;
60                XYSeries density;
61                density = new XYSeries(hist.getTitle(),true,false);
62                for (HistogramBucketInformation bucketInformation : hist.getBucketInformation()) {
63                        if (sum == 0) // is only executed the first time in the loop.
64                                density.add(bucketInformation.getValue(), sum);
65                        sum += bucketInformation.getProbability();
66                        if (sum != 0)
67                                density.add(bucketInformation.getValue() + hist.getBucketWidth(), sum);
68//                        if (sum == 1)
69//                                density.add(bucketInformation.getValue() + hist.getBucketWidth(), sum);
70                }
71                return density;
72        }
73 
74}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov