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

COVERAGE SUMMARY FOR SOURCE FILE [FileSensorDAO.java]

nameclass, %method, %block, %line, %
FileSensorDAO.java100% (1/1)43%  (3/7)46%  (47/102)50%  (13/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FileSensorDAO100% (1/1)43%  (3/7)46%  (47/102)50%  (13/26)
addScalabilitySensor (String): ScalabilitySensor 0%   (0/1)0%   (0/19)0%   (0/5)
findBySensorName (String): Collection 0%   (0/1)0%   (0/28)0%   (0/5)
getSensors (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
removeSensor (Sensor, boolean): void 0%   (0/1)0%   (0/5)0%   (0/2)
FileSensorDAO (FileDAOFactory, IDGenerator): void 100% (1/1)100% (6/6)100% (2/2)
addStateSensor (State, String): StateSensor 100% (1/1)100% (22/22)100% (6/6)
addTimeSpanSensor (String): TimeSpanSensor 100% (1/1)100% (19/19)100% (5/5)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.sensorframework.dao.file;
5 
6import java.util.ArrayList;
7import java.util.Collection;
8import java.util.Collections;
9 
10import de.uka.ipd.sdq.sensorframework.dao.file.entities.ScalabilitySensorImpl;
11import de.uka.ipd.sdq.sensorframework.dao.file.entities.StateSensorImpl;
12import de.uka.ipd.sdq.sensorframework.dao.file.entities.TimeSpanSensorImpl;
13import de.uka.ipd.sdq.sensorframework.entities.ScalabilitySensor;
14import de.uka.ipd.sdq.sensorframework.entities.Sensor;
15import de.uka.ipd.sdq.sensorframework.entities.State;
16import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
17import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor;
18import de.uka.ipd.sdq.sensorframework.entities.dao.ISensorDAO;
19 
20/**
21 * @author Ihssane El-Oudghiri 
22 * @author Steffen Becker
23 * 
24 * Data Access Object (DAO) for persistence of Sensor Objects.
25 * 
26 */
27public class FileSensorDAO extends AbstractFileDAO<Sensor> implements ISensorDAO {
28 
29        public FileSensorDAO(FileDAOFactory factory, IDGenerator idGen) {
30                super(factory,idGen,FileDAOFactory.SENSOR_FILE_NAME_PREFIX);
31        }
32 
33        public StateSensor addStateSensor(State p_initialstate, String p_sensorname) {
34                StateSensor stsen = new StateSensorImpl(factory);
35                stsen.setInitialState(p_initialstate);
36                stsen.setSensorName(p_sensorname);
37                stsen.setSensorID(idGen.getNextSensorID());
38 
39                this.putEntity(stsen);
40                
41                return stsen;
42        }
43 
44        public TimeSpanSensor addTimeSpanSensor(String p_sensorname) {
45                TimeSpanSensor result = new TimeSpanSensorImpl(factory);
46                result.setSensorID(idGen.getNextSensorID());
47                result.setSensorName(p_sensorname);
48 
49                this.putEntity(result);
50                
51                return result;
52        }
53        
54        public ScalabilitySensor addScalabilitySensor(String p_sensorname) {
55                ScalabilitySensor result = new ScalabilitySensorImpl(factory);
56                result.setSensorID(idGen.getNextSensorID());
57                result.setSensorName(p_sensorname);
58 
59                this.putEntity(result);
60                
61                return result;
62        }
63 
64        public Collection<Sensor> findBySensorName(String searchKey) {
65                Collection<Sensor> result = new ArrayList<Sensor>();
66                for (Sensor sen : getAllEntities())
67                        if (sen.getSensorName().equals(searchKey))
68                                result.add(sen);
69 
70                return Collections.unmodifiableCollection(result);
71        }
72 
73        public Collection<Sensor> getSensors() {
74                return this.getAllEntities();
75        }
76 
77        public void removeSensor(Sensor sensor, boolean doCascade) {
78                this.removeEntity(sensor, doCascade);
79        }
80 
81 
82}

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