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

COVERAGE SUMMARY FOR SOURCE FILE [TreeContainer.java]

nameclass, %method, %block, %line, %
TreeContainer.java0%   (0/1)0%   (0/7)0%   (0/102)0%   (0/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TreeContainer0%   (0/1)0%   (0/7)0%   (0/102)0%   (0/25)
TreeContainer (IDAOFactory, Experiment, int): void 0%   (0/1)0%   (0/84)0%   (0/18)
getAdapter (Class): Object 0%   (0/1)0%   (0/2)0%   (0/1)
getElements (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getParent (): Experiment 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): int 0%   (0/1)0%   (0/3)0%   (0/1)
setParent (Experiment): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.sensorframework.visualisation.views;
2 
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.List;
6 
7import org.eclipse.core.runtime.IAdaptable;
8 
9import de.uka.ipd.sdq.sensorframework.entities.Experiment;
10import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
11import de.uka.ipd.sdq.sensorframework.entities.Sensor;
12import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
13 
14/**
15 * @author roman
16 * 
17 * The content provider class is responsible for providing objects to the view.
18 * It can wrap existing objects in adapters or simply return objects as-is.
19 * These objects may be sensitive to the current input of the view, or ignore it
20 * and always show the same content (like Task List, for example).
21 */
22public class TreeContainer implements IAdaptable {
23        
24        private Experiment experiment;
25        private List<TreeObject> elements = null;
26        private String name;
27        private int type;
28        
29        private String EXPERIMENT_RUNS_NAME = "Experiment Runs";
30        private String SENSORS_NAME                 = "Sensors";
31 
32        /**
33         * REFACTORIN!!
34         * @param experiment
35         */
36        public TreeContainer(IDAOFactory datasource, Experiment experiment, int type) {
37                this.experiment = experiment;
38                this.type = type;
39                this.elements = new ArrayList<TreeObject>();
40 
41                if (type == TreeContentProvider.EXPERIMENT_RUNS){
42                        Collection<ExperimentRun> runs = experiment.getExperimentRuns();
43                        for(ExperimentRun r : runs)
44                                elements.add(new TreeObject(r,datasource,experiment));
45 
46                        this.name = EXPERIMENT_RUNS_NAME;
47                }
48                if (type == TreeContentProvider.SENSORS){
49                        Collection<Sensor> sensors = experiment.getSensors();
50                        for(Sensor s : sensors)
51                                elements.add(new TreeObject (s,datasource,experiment));
52                        
53                        this.name = SENSORS_NAME;
54                }
55        }
56 
57        public List<TreeObject> getElements() {
58                return elements;
59        }
60 
61        public Experiment getParent() {
62                return experiment;
63        }
64 
65        public void setParent(Experiment parent) {
66                this.experiment = parent;
67        }
68 
69        @SuppressWarnings("unchecked")
70        public Object getAdapter(Class adapter) {
71//                if (adapter == de.uka.ipd.sdq.sensorfactory.entities.ExperimentRun.class) {
72//                        this.elements = experiment.getExperimentRuns();
73//                        this.name = EXPERIMENT_RUNS_NAME;
74//                        return this;
75//                }
76//                if (adapter == de.uka.ipd.sdq.sensorfactory.entities.Sensor.class) {
77//                        this.elements = experiment.getSensors();
78//                        this.name = SENSORS_NAME;
79//                        return this;
80//                }
81                return null;
82        }
83 
84        public String getName() {
85                return name;
86        }
87 
88        public int getType() {
89                return type;
90        }
91}

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