Package: VdmOperationCompletionExtractor

VdmOperationCompletionExtractor

nameinstructionbranchcomplexitylinemethod
VdmOperationCompletionExtractor()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
explicitOperationNameExtractor(AExplicitOperationDefinition)
M: 48 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
explicitOperationParameterNameExtractor(AExplicitOperationDefinition)
M: 25 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
implicitOperationNameExtractor(AImplicitOperationDefinition)
M: 48 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
implicitOperationParameterNameExtractor(AImplicitOperationDefinition)
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package org.overture.ide.ui.templates;
2:
3: import java.util.ArrayList;
4: import java.util.LinkedList;
5: import java.util.List;
6:
7: import org.overture.ast.definitions.AExplicitFunctionDefinition;
8: import org.overture.ast.definitions.AExplicitOperationDefinition;
9: import org.overture.ast.definitions.AImplicitFunctionDefinition;
10: import org.overture.ast.definitions.AImplicitOperationDefinition;
11: import org.overture.ast.patterns.APatternListTypePair;
12: import org.overture.ast.patterns.PPattern;
13:
14: public class VdmOperationCompletionExtractor {
15:         
16:         private static VdmCompletionHelper VdmHelper = new VdmCompletionHelper();
17:         
18:         public String[] explicitOperationNameExtractor(AExplicitOperationDefinition node){
19:                 String[] functionName = new String[2];
20:                 String[] SplitName = (node.getName().toString()).split("\\(");
21:         functionName[0] = SplitName[0];
22:         
23:•         if(functionName[0] != null && !functionName[0].isEmpty()){
24:                 functionName[1] = functionName[0] + "("; //ReplacemestString
25:         }
26:         List<String> parameterNameList = null;
27:
28:         parameterNameList = explicitOperationParameterNameExtractor(node);
29:
30:         return VdmHelper.templatePatternGenerator(parameterNameList,functionName);
31: }
32:         
33:         public String[] implicitOperationNameExtractor(AImplicitOperationDefinition node){
34:                 String[] functionName = new String[2];
35:                 String[] SplitName = (node.getName().toString()).split("\\(");
36:         functionName[0] = SplitName[0];
37:         
38:•         if(functionName[0] != null && !functionName[0].isEmpty()){
39:                 functionName[1] = functionName[0] + "("; //ReplacemestString
40:         }
41:         List<String> parameterNameList = null;
42:
43:         parameterNameList = implicitOperationParameterNameExtractor(node);
44:
45:         return VdmHelper.templatePatternGenerator(parameterNameList,functionName);
46: }
47:         
48:         public List<String> explicitOperationParameterNameExtractor(AExplicitOperationDefinition node) {
49:
50:         List<String> parameterNameList = new ArrayList<String>();
51:         LinkedList<PPattern> strList = node.getParameterPatterns();
52:         
53:•         for(int i = 0;i < strList.size(); i++){
54:                 parameterNameList.add(strList.get(i).toString());
55:         }
56:                 return parameterNameList;
57:         }
58:         
59:         public List<String> implicitOperationParameterNameExtractor(AImplicitOperationDefinition node) {
60:
61:         List<String> parameterNameList = new ArrayList<String>();
62:         LinkedList<APatternListTypePair> strList = node.getParameterPatterns();
63:
64:•         for(int i = 0;i < strList.size(); i++){
65:                 parameterNameList.add(strList.get(i).getPatterns().getFirst().toString());
66:         }
67:                 return parameterNameList;
68:         }
69: }