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

nameclass, %method, %block, %line, %
FileStateDAO.java100% (1/1)60%  (3/5)47%  (29/62)53%  (8/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FileStateDAO100% (1/1)60%  (3/5)47%  (29/62)53%  (8/15)
findByStateLiteral (String): Collection 0%   (0/1)0%   (0/28)0%   (0/5)
removeState (State, boolean): void 0%   (0/1)0%   (0/5)0%   (0/2)
FileStateDAO (FileDAOFactory, IDGenerator): void 100% (1/1)100% (6/6)100% (2/2)
addState (String): State 100% (1/1)100% (19/19)100% (5/5)
getStates (): Collection 100% (1/1)100% (4/4)100% (1/1)

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.StateImpl;
11import de.uka.ipd.sdq.sensorframework.entities.State;
12import de.uka.ipd.sdq.sensorframework.entities.dao.IStateDAO;
13 
14/**
15 * @author Ihssane El-Oudghiri 
16 * @author Steffen Becker
17 * 
18 * Data Access Object (DAO) for persistence of State Objects.
19 * 
20 */
21public class FileStateDAO extends AbstractFileDAO<State> implements IStateDAO {
22 
23        public FileStateDAO(FileDAOFactory factory, IDGenerator idGen) {
24                super(factory,idGen,FileDAOFactory.STATE_FILE_NAME_PREFIX);
25        }
26 
27        public State addState(String p_stateliteral) {
28                State state = new StateImpl(this.factory);
29                state.setStateID(idGen.getNextStateID());
30                state.setStateLiteral(p_stateliteral);
31                
32                this.putEntity(state);
33 
34                return state;
35        }
36 
37        public Collection<State> findByStateLiteral(String searchKey) {
38                Collection<State> result = new ArrayList<State>();
39                for (State state : getAllEntities())
40                        if (state.getStateLiteral().equals(searchKey))
41                                result.add(state);
42                return Collections.unmodifiableCollection(result);
43        }
44 
45        public Collection<State> getStates() {
46                return Collections.unmodifiableCollection(getAllEntities());
47        }
48 
49        public void removeState(State state, boolean doCascade) {
50                this.removeEntity(state, doCascade);
51        }
52}

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