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

COVERAGE SUMMARY FOR SOURCE FILE [ConfigEntry.java]

nameclass, %method, %block, %line, %
ConfigEntry.java0%   (0/1)0%   (0/9)0%   (0/120)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigEntry0%   (0/1)0%   (0/9)0%   (0/120)0%   (0/29)
ConfigEntry (IDAOFactory, ExperimentRun, Experiment, Sensor): void 0%   (0/1)0%   (0/29)0%   (0/8)
getDatasource (): IDAOFactory 0%   (0/1)0%   (0/5)0%   (0/1)
getExperiment (): Experiment 0%   (0/1)0%   (0/7)0%   (0/1)
getExperimentRun (): ExperimentRun 0%   (0/1)0%   (0/7)0%   (0/1)
getSensors (): List 0%   (0/1)0%   (0/27)0%   (0/4)
isSensorChecked (Sensor): boolean 0%   (0/1)0%   (0/12)0%   (0/3)
setExperiment (Experiment): void 0%   (0/1)0%   (0/5)0%   (0/2)
setSensorChecked (Sensor): void 0%   (0/1)0%   (0/16)0%   (0/5)
setSensorUnchecked (Sensor): void 0%   (0/1)0%   (0/12)0%   (0/4)

1package de.uka.ipd.sdq.sensorframework.visualisation.editor;
2 
3import java.util.ArrayList;
4import java.util.List;
5import java.util.Observable;
6 
7import de.uka.ipd.sdq.sensorframework.SensorFrameworkDataset;
8import de.uka.ipd.sdq.sensorframework.entities.Experiment;
9import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
10import de.uka.ipd.sdq.sensorframework.entities.Sensor;
11import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
12 
13/**
14 * TODO: Document me! What do I do?
15 * @author ?
16 *
17 */
18public class ConfigEntry extends Observable {
19        private List<Long> sensorIDs;
20        private long experimentRunID;
21        private long experimentID;
22        private long datasourceID;
23 
24        public ConfigEntry(IDAOFactory factory, ExperimentRun experimentRun, Experiment experiment,
25                        Sensor sensor) {
26                this.datasourceID = factory.getID();
27                this.experimentRunID = experimentRun.getExperimentRunID();
28                this.experimentID = experiment.getExperimentID();
29                this.sensorIDs = new ArrayList<Long>();
30                if (sensor != null)
31                        this.sensorIDs.add(sensor.getSensorID());
32        }
33        
34        public List<Sensor> getSensors() {
35                ArrayList<Sensor> result = new ArrayList<Sensor>();
36                for (long sensorID : this.sensorIDs)
37                        result.add(getDatasource().createSensorDAO().get(sensorID));
38                return result;
39        }
40 
41        /** 
42         * Adds the given Sensor (or its id, respectively) to the list of
43         * sensors of this ConfigEntry. TODO: What does that mean? Are these the 
44         * sensors shown in one diagram, for example?     
45         * @param sensor
46         */
47        public void setSensorChecked(Sensor sensor) {
48                if (!isSensorChecked(sensor)){
49                        sensorIDs.add(sensor.getSensorID());
50                        this.setChanged();
51                }
52                notifyObservers();
53        }
54 
55        public void setSensorUnchecked(Sensor sensor) {
56                sensorIDs.remove(sensor.getSensorID());
57                this.setChanged();
58                notifyObservers();
59        }
60 
61        /**
62         * @return - status of sensor (checked/unchecked)
63         */
64        public boolean isSensorChecked(Sensor sensor) {
65                if (sensorIDs != null) {
66                        return sensorIDs.contains(sensor.getSensorID());
67                }
68                return false;
69        }
70 
71        public ExperimentRun getExperimentRun() {
72                return getDatasource().createExperimentRunDAO().get(experimentRunID);
73        }
74 
75        public Experiment getExperiment() {
76                return getDatasource().createExperimentDAO().get(experimentID);
77        }
78 
79        public void setExperiment(Experiment experiment) {
80                this.experimentID = experiment.getExperimentID();
81        }
82 
83        public IDAOFactory getDatasource() {
84                return SensorFrameworkDataset.singleton().getDataSourceByID(this.datasourceID);
85        }
86}

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