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

COVERAGE SUMMARY FOR SOURCE FILE [LQNUtils.java]

nameclass, %method, %block, %line, %
LQNUtils.java0%   (0/1)0%   (0/3)0%   (0/67)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LQNUtils0%   (0/1)0%   (0/3)0%   (0/67)0%   (0/17)
LQNUtils (): void 0%   (0/1)0%   (0/3)0%   (0/1)
convertStringToDouble (String): double 0%   (0/1)0%   (0/24)0%   (0/6)
getResponseTimeOfSubActivities (TaskType): double 0%   (0/1)0%   (0/40)0%   (0/10)

1package de.uka.ipd.sdq.dsexplore.analysis.lqn;
2 
3import java.text.DecimalFormat;
4import java.text.DecimalFormatSymbols;
5import java.text.ParseException;
6import java.util.Locale;
7 
8import org.eclipse.emf.common.util.EList;
9 
10import LqnCore.ActivityDefType;
11import LqnCore.OutputResultType;
12import LqnCore.TaskType;
13 
14import de.uka.ipd.sdq.dsexplore.analysis.AnalysisFailedException;
15 
16/**
17 * Provides utility methods which are useful when working with LQN.
18 * 
19 * @author pmerkle
20 * 
21 */
22public class LQNUtils {
23 
24        /**
25         * Converts the given String in LQN specific scientific format (e.g.
26         * 1.0E-003) to the corresponding double value.
27         * 
28         * @param toConvert
29         * @return
30         * @throws AnalysisFailedException
31         */
32        public static double convertStringToDouble(String toConvert) throws ParseException {
33                double ret;
34 
35                toConvert = toConvert.replaceAll("e", "E");
36                toConvert = toConvert.replaceAll("\\+", "");
37                DecimalFormat format = new DecimalFormat("0.0E000",
38                                DecimalFormatSymbols.getInstance(Locale.ENGLISH));
39                ret = format.parse(toConvert).doubleValue();
40 
41                return ret;
42        }
43        
44        public static double getResponseTimeOfSubActivities(TaskType task) throws ParseException {
45                // We add all result service times of the usage scenario to compute
46                // the response time
47                // TODO: check whether this works correctly if the usage scenario
48                // contains branches
49                double time = 0;
50                EList<ActivityDefType> activities = task.getTaskActivities()
51                                .getActivity();
52                for (ActivityDefType activity : activities) {
53                        EList<OutputResultType> results = activity.getResultActivity();
54                        for (OutputResultType outputResultType : results) {
55 
56                                time += LQNUtils
57                                                .convertStringToDouble((String) outputResultType
58                                                                .getServiceTime());
59                        }
60 
61                }
62                return time;
63        }
64        
65        
66}

[all classes][de.uka.ipd.sdq.dsexplore.analysis.lqn]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov