Package: IsValChecker

IsValChecker

nameinstructionbranchcomplexitylinemethod
IsValChecker()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAEnumMapExpIR(AEnumMapExpIR)
M: 24 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseAEnumSeqExpIR(AEnumSeqExpIR)
M: 24 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseAEnumSetExpIR(AEnumSetExpIR)
M: 24 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseAIdentifierVarExpIR(AIdentifierVarExpIR)
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%
caseAMapletExpIR(AMapletExpIR)
M: 19 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAMinusUnaryExpIR(AMinusUnaryExpIR)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAMkBasicExpIR(AMkBasicExpIR)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseANewExpIR(ANewExpIR)
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%
caseANullExpIR(ANullExpIR)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAPlusUnaryExpIR(APlusUnaryExpIR)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(INode)
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%
createNewReturnValue(Object)
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%
defaultINode(INode)
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%
defaultSLiteralExpIR(SLiteralExpIR)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
defaultSNumericBinaryExpIR(SNumericBinaryExpIR)
M: 28 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package org.overture.codegen.vdm2jml.util;
2:
3: import org.overture.codegen.ir.INode;
4: import org.overture.codegen.ir.SExpIR;
5: import org.overture.codegen.ir.analysis.AnalysisException;
6: import org.overture.codegen.ir.analysis.AnswerAdaptor;
7: import org.overture.codegen.ir.expressions.AEnumMapExpIR;
8: import org.overture.codegen.ir.expressions.AEnumSeqExpIR;
9: import org.overture.codegen.ir.expressions.AEnumSetExpIR;
10: import org.overture.codegen.ir.expressions.AIdentifierVarExpIR;
11: import org.overture.codegen.ir.expressions.AMapletExpIR;
12: import org.overture.codegen.ir.expressions.AMinusUnaryExpIR;
13: import org.overture.codegen.ir.expressions.AMkBasicExpIR;
14: import org.overture.codegen.ir.expressions.ANewExpIR;
15: import org.overture.codegen.ir.expressions.ANullExpIR;
16: import org.overture.codegen.ir.expressions.APlusUnaryExpIR;
17: import org.overture.codegen.ir.expressions.SLiteralExpIR;
18: import org.overture.codegen.ir.expressions.SNumericBinaryExpIR;
19:
20: public class IsValChecker extends AnswerAdaptor<Boolean>
21: {
22:         @Override
23:         public Boolean defaultINode(INode node) throws AnalysisException
24:         {
25:                 // Return false for all other cases
26:                 return false;
27:         }
28:
29:         @Override
30:         public Boolean caseAIdentifierVarExpIR(AIdentifierVarExpIR node)
31:                         throws AnalysisException
32:         {
33:
34:                 return true;
35:         }
36:
37:         @Override
38:         public Boolean defaultSLiteralExpIR(SLiteralExpIR node)
39:                         throws AnalysisException
40:         {
41:                 return true;
42:         }
43:
44:         @Override
45:         public Boolean caseAMkBasicExpIR(AMkBasicExpIR node)
46:                         throws AnalysisException
47:         {
48:                 // Token value
49:                 return true;
50:         }
51:
52:         @Override
53:         public Boolean caseANullExpIR(ANullExpIR node) throws AnalysisException
54:         {
55:                 return true;
56:         }
57:
58:         @Override
59:         public Boolean caseANewExpIR(ANewExpIR node) throws AnalysisException
60:         {
61:                 return true;
62:         }
63:
64:         @Override
65:         public Boolean caseAEnumMapExpIR(AEnumMapExpIR node)
66:                         throws AnalysisException
67:         {
68:
69:•                for (AMapletExpIR m : node.getMembers())
70:                 {
71:•                        if (!m.apply(this))
72:                         {
73:                                 return false;
74:                         }
75:                 }
76:
77:                 return true;
78:         }
79:
80:         @Override
81:         public Boolean caseAEnumSeqExpIR(AEnumSeqExpIR node)
82:                         throws AnalysisException
83:         {
84:
85:•                for (SExpIR m : node.getMembers())
86:                 {
87:•                        if (!m.apply(this))
88:                         {
89:                                 return false;
90:                         }
91:                 }
92:
93:                 return true;
94:         }
95:
96:         @Override
97:         public Boolean caseAEnumSetExpIR(AEnumSetExpIR node)
98:                         throws AnalysisException
99:         {
100:
101:•                for (SExpIR m : node.getMembers())
102:                 {
103:•                        if (!m.apply(this))
104:                         {
105:                                 return false;
106:                         }
107:                 }
108:
109:                 return true;
110:         }
111:
112:         @Override
113:         public Boolean caseAMapletExpIR(AMapletExpIR node) throws AnalysisException
114:         {
115:
116:•                return node.getLeft().apply(this) && node.getRight().apply(this);
117:         }
118:
119:         @Override
120:         public Boolean defaultSNumericBinaryExpIR(SNumericBinaryExpIR node)
121:                         throws AnalysisException
122:         {
123:•                if (node.getLeft() == null || node.getRight() == null)
124:                 {
125:                         return false;
126:                 }
127:
128:•                return node.getLeft().apply(this) && node.getRight().apply(this);
129:         }
130:
131:         @Override
132:         public Boolean caseAMinusUnaryExpIR(AMinusUnaryExpIR node)
133:                         throws AnalysisException
134:         {
135:•                if (node.getExp() == null)
136:                 {
137:                         return false;
138:                 } else
139:                 {
140:                         return node.getExp().apply(this);
141:                 }
142:         }
143:
144:         @Override
145:         public Boolean caseAPlusUnaryExpIR(APlusUnaryExpIR node)
146:                         throws AnalysisException
147:         {
148:•                if (node.getExp() == null)
149:                 {
150:                         return false;
151:                 } else
152:                 {
153:                         return node.getExp().apply(this);
154:                 }
155:         }
156:
157:         // Do not expect to hit the cases below:
158:
159:         @Override
160:         public Boolean createNewReturnValue(INode node) throws AnalysisException
161:         {
162:                 return false;
163:         }
164:
165:         @Override
166:         public Boolean createNewReturnValue(Object node) throws AnalysisException
167:         {
168:                 return false;
169:         }
170:
171: }