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

nameclass, %method, %block, %line, %
NumberOfElementsComputationForSignature.java0%   (0/1)0%   (0/6)0%   (0/143)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NumberOfElementsComputationForSignature0%   (0/1)0%   (0/6)0%   (0/143)0%   (0/28)
$SWITCH_TABLE$de$uka$ipd$sdq$pcm$transformations$BytesizeComputationForSignat... 0%   (0/1)0%   (0/27)0%   (0/1)
NumberOfElementsComputationForSignature (): void 0%   (0/1)0%   (0/3)0%   (0/1)
appendStoEx (String, String): String 0%   (0/1)0%   (0/22)0%   (0/5)
countAmount (OperationSignature, PrimitiveTypeEnum, BytesizeComputationForSig... 0%   (0/1)0%   (0/50)0%   (0/10)
countForParameter (Parameter, PrimitiveTypeEnum): String 0%   (0/1)0%   (0/12)0%   (0/2)
matchesModifier (Parameter, BytesizeComputationForSignature$Modifier): boolean 0%   (0/1)0%   (0/29)0%   (0/10)

1package de.uka.ipd.sdq.pcm.transformations.builder.util;
2 
3import de.uka.ipd.sdq.pcm.repository.OperationSignature;
4import de.uka.ipd.sdq.pcm.repository.Parameter;
5import de.uka.ipd.sdq.pcm.repository.ParameterModifier;
6import de.uka.ipd.sdq.pcm.repository.PrimitiveTypeEnum;
7import de.uka.ipd.sdq.pcm.transformations.BytesizeComputationForSignature.Modifier;
8 
9public class NumberOfElementsComputationForSignature {
10 
11        public static String countAmount(
12                        OperationSignature currentSignature,
13                        PrimitiveTypeEnum type, 
14                        Modifier modifier) {
15                
16                String result = null;
17                for (Parameter p : currentSignature.getParameters__OperationSignature()) {
18                        if (matchesModifier(p,modifier)){
19                                String stoex = countForParameter(p, type);
20                                result = appendStoEx(result, stoex);
21                        }
22                }
23                if (currentSignature.getReturnType__OperationSignature() != null && modifier == Modifier.OUT){
24                        TypesCountingVisitor visitor = new TypesCountingVisitor("RETURN",type);
25                        String stoex = visitor.doSwitch(currentSignature.getReturnType__OperationSignature());
26                        result = appendStoEx(result, stoex);
27                }
28                return result;
29        }
30 
31        private static String appendStoEx(String result, String stoex) {
32                if (stoex != null){
33                        if (result == null) {
34                                result = stoex;
35                        } else {
36                                result += " + (" + stoex + ")";
37                        }
38                }
39                return result;
40        }
41        
42        private static boolean matchesModifier(Parameter p, Modifier modifier) {
43                ParameterModifier parMod = p.getModifier__Parameter();
44                switch(modifier){
45                case IN:
46                        if (parMod == ParameterModifier.IN || 
47                                        parMod == ParameterModifier.INOUT || 
48                                        parMod == ParameterModifier.NONE)
49                                return true;
50                        break;
51                case OUT:
52                        if (parMod == ParameterModifier.INOUT || 
53                                        parMod == ParameterModifier.OUT)
54                                return true;
55                        break;
56                }
57                return false;
58        }
59 
60        private static String countForParameter(Parameter p, PrimitiveTypeEnum type) {
61                TypesCountingVisitor visitor = new TypesCountingVisitor(p,type);
62                return visitor.doSwitch(p.getDataType__Parameter());
63        }
64 
65}

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