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

COVERAGE SUMMARY FOR SOURCE FILE [Pcm2RegexHelper.java]

nameclass, %method, %block, %line, %
Pcm2RegexHelper.java0%   (0/1)0%   (0/2)0%   (0/66)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Pcm2RegexHelper0%   (0/1)0%   (0/2)0%   (0/66)0%   (0/17)
Pcm2RegexHelper (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createAlternativesForExpressions (List): Expression 0%   (0/1)0%   (0/63)0%   (0/16)

1package de.uka.ipd.sdq.pcmsolver.transformations.pcm2regex;
2 
3import java.util.List;
4 
5import de.uka.ipd.sdq.spa.expression.Alternative;
6import de.uka.ipd.sdq.spa.expression.Expression;
7import de.uka.ipd.sdq.spa.expression.ExpressionFactory;
8import de.uka.ipd.sdq.spa.expression.Option;
9 
10public class Pcm2RegexHelper {
11 
12        public static Expression createAlternativesForExpressions(
13                        List<Option> listOfExpressions) {
14                
15                if (listOfExpressions.size() == 1){
16                        return listOfExpressions.get(0).getRegexp();
17                } else if (listOfExpressions.size() == 0){
18                        return null;
19                }
20                
21                ExpressionFactory expFactory = ExpressionFactory.eINSTANCE;
22                Alternative alternative = expFactory.createAlternative();
23                
24                Option leftOption = listOfExpressions.get(0);
25                alternative.setLeftOption(leftOption);
26                
27                Option rightOption = expFactory.createOption();
28                alternative.setRightOption(rightOption);
29                rightOption.setProbability(1-leftOption.getProbability());
30                
31                if (listOfExpressions.size() == 2){
32                        //this is the leaf
33                        alternative.setRightOption(listOfExpressions.get(1));
34                } else {
35                        Expression subAlternative = createAlternativesForExpressions(listOfExpressions.subList(1, listOfExpressions.size()));
36                        rightOption.setRegexp(subAlternative);
37                }
38                return alternative;
39        }
40        
41}

[all classes][de.uka.ipd.sdq.pcmsolver.transformations.pcm2regex]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov