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

COVERAGE SUMMARY FOR SOURCE FILE [TypesCountingVisitor.java]

nameclass, %method, %block, %line, %
TypesCountingVisitor.java0%   (0/1)0%   (0/6)0%   (0/121)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TypesCountingVisitor0%   (0/1)0%   (0/6)0%   (0/121)0%   (0/23)
TypesCountingVisitor (Parameter, PrimitiveTypeEnum): void 0%   (0/1)0%   (0/17)0%   (0/5)
TypesCountingVisitor (String, PrimitiveTypeEnum): void 0%   (0/1)0%   (0/16)0%   (0/5)
caseCollectionDataType (CollectionDataType): String 0%   (0/1)0%   (0/38)0%   (0/6)
caseCompositeDataType (CompositeDataType): String 0%   (0/1)0%   (0/5)0%   (0/1)
casePrimitiveDataType (PrimitiveDataType): String 0%   (0/1)0%   (0/12)0%   (0/3)
getPrefix (): String 0%   (0/1)0%   (0/33)0%   (0/4)

1package de.uka.ipd.sdq.pcm.transformations.builder.util;
2 
3import java.util.Stack;
4 
5import de.uka.ipd.sdq.pcm.repository.CollectionDataType;
6import de.uka.ipd.sdq.pcm.repository.CompositeDataType;
7import de.uka.ipd.sdq.pcm.repository.Parameter;
8import de.uka.ipd.sdq.pcm.repository.PrimitiveDataType;
9import de.uka.ipd.sdq.pcm.repository.PrimitiveTypeEnum;
10import de.uka.ipd.sdq.pcm.repository.util.RepositorySwitch;
11 
12public class TypesCountingVisitor extends RepositorySwitch<String> {
13 
14        private PrimitiveTypeEnum type;
15        private Stack<String> prefixes = new Stack<String>();
16 
17        public TypesCountingVisitor(Parameter p, PrimitiveTypeEnum type) {
18                this.type = type;
19                prefixes.push(p.getParameterName());
20        }
21 
22        public TypesCountingVisitor(String name, PrimitiveTypeEnum type) {
23                this.type = type;
24                prefixes.push(name);
25        }
26 
27        @Override
28        public String caseCollectionDataType(CollectionDataType object) {
29            String innerStoEx = this.doSwitch(object.getInnerType_CollectionDataType());
30            if (innerStoEx != null) {
31                    if (innerStoEx.equals("1")){
32                            return getPrefix() + ".NUMBER_OF_ELEMENTS";
33                    } else {
34                            //TODO: use sum instead for correct stochastic processing!
35                            return getPrefix() + ".NUMBER_OF_ELEMENTS * ("+innerStoEx+")";
36                    }
37            } else
38                    return null;
39        }
40 
41        private String getPrefix() {
42                String result = "";
43                for (String s : prefixes) {
44                        result += s +".";
45                }
46                return result.substring(0, result.length()-1);
47        }
48 
49        @Override
50        public String caseCompositeDataType(CompositeDataType object) {
51                return super.caseCompositeDataType(object);
52        }
53 
54        @Override
55        public String casePrimitiveDataType(PrimitiveDataType object) {
56                if (object.getType() == this.type)
57                        return "1";
58                return super.casePrimitiveDataType(object);
59        }
60}

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