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 [ExportDoublePDF.java]

nameclass, %method, %block, %line, %
ExportDoublePDF.java0%   (0/1)0%   (0/3)0%   (0/116)0%   (0/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExportDoublePDF0%   (0/1)0%   (0/3)0%   (0/116)0%   (0/20)
ExportDoublePDF (IHistSeriesExporter): void 0%   (0/1)0%   (0/9)0%   (0/4)
exportCSV (XYSeries): String 0%   (0/1)0%   (0/76)0%   (0/9)
run (): void 0%   (0/1)0%   (0/31)0%   (0/7)

1package de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation;
2 
3import org.eclipse.jface.action.Action;
4import org.eclipse.swt.dnd.Clipboard;
5import org.eclipse.swt.dnd.TextTransfer;
6import org.eclipse.swt.dnd.Transfer;
7import org.eclipse.ui.PlatformUI;
8import org.jfree.data.xy.XYDataItem;
9import org.jfree.data.xy.XYSeries;
10 
11public class ExportDoublePDF extends Action {
12 
13        private IHistSeriesExporter viewer;
14 
15        public ExportDoublePDF(IHistSeriesExporter freeChartHistogramViewer) {
16                super();
17                setText("Copy to Clipboard as DoublePDF...");
18                this.viewer = freeChartHistogramViewer;
19        }
20        
21        @Override
22        public void run() {
23                String pdf = exportCSV(viewer.getSeries());
24                Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
25                TextTransfer textTransfer = TextTransfer.getInstance();
26                clipboard.setContents(new String[] { pdf },
27                                new Transfer[] { textTransfer });
28                clipboard.dispose();
29        }
30 
31        private String exportCSV(XYSeries series) {
32                String result = "DoublePDF["; 
33                double lastProb = 0;
34                double lastX = 0;
35                for(Object item : series.getItems()){
36                        XYDataItem data = (XYDataItem) item;
37                        result += "(" + (data.getX().doubleValue() - viewer.getHistogramWidth() / 2) + ";" + lastProb + ")";
38                        lastProb = data.getY().doubleValue();
39                        lastX = data.getX().doubleValue();
40                }                
41                return result + "("+(lastX+viewer.getHistogramWidth()/2)+";"+lastProb+")]";
42        }
43}

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