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

COVERAGE SUMMARY FOR SOURCE FILE [ExperimentRunsDialogContentProvider.java]

nameclass, %method, %block, %line, %
ExperimentRunsDialogContentProvider.java0%   (0/1)0%   (0/8)0%   (0/131)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExperimentRunsDialogContentProvider0%   (0/1)0%   (0/8)0%   (0/131)0%   (0/31)
ExperimentRunsDialogContentProvider (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createExperimentAndDAOList (IDAOFactory, Collection): List 0%   (0/1)0%   (0/25)0%   (0/4)
dispose (): void 0%   (0/1)0%   (0/1)0%   (0/1)
getChildren (Object): Object [] 0%   (0/1)0%   (0/66)0%   (0/14)
getElements (Object): Object [] 0%   (0/1)0%   (0/19)0%   (0/4)
getParent (Object): Object 0%   (0/1)0%   (0/2)0%   (0/1)
hasChildren (Object): boolean 0%   (0/1)0%   (0/14)0%   (0/5)
inputChanged (Viewer, Object, Object): void 0%   (0/1)0%   (0/1)0%   (0/1)

1package de.uka.ipd.sdq.sensorframework.visualisation.dialogs;
2 
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.List;
6 
7import org.eclipse.jface.viewers.ITreeContentProvider;
8import org.eclipse.jface.viewers.Viewer;
9 
10import de.uka.ipd.sdq.sensorframework.SensorFrameworkDataset;
11import de.uka.ipd.sdq.sensorframework.entities.Experiment;
12import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
13import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
14import de.uka.ipd.sdq.sensorframework.entities.dao.IExperimentDAO;
15import de.uka.ipd.sdq.sensorframework.visualisation.views.ExperimentAndDAO;
16import de.uka.ipd.sdq.sensorframework.visualisation.views.TreeObject;
17 
18/** @author roman */
19public class ExperimentRunsDialogContentProvider implements ITreeContentProvider {
20        
21        private List<IDAOFactory> root;
22 
23        /* (non-Javadoc)
24         * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
25         */
26        @SuppressWarnings("unchecked")
27        public Object[] getChildren(Object parent) {
28                
29                if (parent instanceof ArrayList) 
30                        return ((ArrayList<IDAOFactory>) parent).toArray();
31                
32                if (parent instanceof IDAOFactory){
33                        IExperimentDAO experimentDAO = ((IDAOFactory)parent).createExperimentDAO();
34                        return createExperimentAndDAOList((IDAOFactory)parent,experimentDAO.getExperiments()).toArray();
35                }
36 
37                if (parent instanceof ExperimentAndDAO) {
38                        ExperimentAndDAO experiment = (ExperimentAndDAO) parent;
39                        Collection<ExperimentRun> runs = experiment.getExperiment().getExperimentRuns();
40                        Object[] objects = new Object[runs.size()];
41                        int i = 0;
42                        for (ExperimentRun r : runs)
43                                objects[i++] = new TreeObject(r,experiment.getDatasource(), experiment.getExperiment());
44 
45                        return objects;
46                }
47                        
48 
49                return new Object[0];
50        }
51 
52        private List<ExperimentAndDAO> createExperimentAndDAOList(
53                        IDAOFactory dao, Collection<Experiment> experiments){
54                ArrayList<ExperimentAndDAO>result = new ArrayList<ExperimentAndDAO>();
55                for(Experiment e:experiments)
56                        result.add(new ExperimentAndDAO(dao,e));
57                return result;
58        }
59        
60        /* (non-Javadoc)
61         * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
62         */
63        public Object getParent(Object element) {
64                // TODO Auto-generated method stub
65                return null;
66        }
67 
68        /* (non-Javadoc)
69         * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
70         */
71        public boolean hasChildren(Object element) {
72                if (element instanceof TreeObject){
73                        TreeObject object = (TreeObject) element;
74                        if (object.getObject() instanceof ExperimentRun)
75                                return false;
76                }
77                return true;
78        }
79 
80        /* (non-Javadoc)
81         * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
82         */
83        public Object[] getElements(Object inputElement) {
84                if (root == null){
85                        root = new ArrayList<IDAOFactory>();
86                        root.addAll(SensorFrameworkDataset.singleton().getDataSources());
87                }
88                return getChildren(root);
89        }
90 
91        /* (non-Javadoc)
92         * @see org.eclipse.jface.viewers.IContentProvider#dispose()
93         */
94        public void dispose() {
95                // TODO Auto-generated method stub
96 
97        }
98 
99        /* (non-Javadoc)
100         * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
101         */
102        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
103                // TODO Auto-generated method stub
104 
105        }
106 
107}

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