Package: KindFinder

KindFinder

nameinstructionbranchcomplexitylinemethod
KindFinder(ITypeCheckerAssistantFactory)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
caseAAssignmentDefinition(AAssignmentDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAClassInvariantDefinition(AClassInvariantDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAEqualsDefinition(AEqualsDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAExplicitFunctionDefinition(AExplicitFunctionDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAExplicitOperationDefinition(AExplicitOperationDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAExternalDefinition(AExternalDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAImplicitFunctionDefinition(AImplicitFunctionDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAImplicitOperationDefinition(AImplicitOperationDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAImportedDefinition(AImportedDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAInheritedDefinition(AInheritedDefinition)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAInstanceVariableDefinition(AInstanceVariableDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseALocalDefinition(ALocalDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAMultiBindListDefinition(AMultiBindListDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAMutexSyncDefinition(AMutexSyncDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseANamedTraceDefinition(ANamedTraceDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAPerSyncDefinition(APerSyncDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseARenamedDefinition(ARenamedDefinition)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAStateDefinition(AStateDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAThreadDefinition(AThreadDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseATypeDefinition(ATypeDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAUntypedDefinition(AUntypedDefinition)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAValueDefinition(AValueDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(INode)
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(Object)
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
defaultPDefinition(PDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultSClassDefinition(SClassDefinition)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 2 C: 6
75%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * #%~
3: * The VDM Type Checker
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.typechecker.utilities;
23:
24: import org.overture.ast.analysis.AnalysisException;
25: import org.overture.ast.analysis.AnswerAdaptor;
26: import org.overture.ast.definitions.AAssignmentDefinition;
27: import org.overture.ast.definitions.AClassInvariantDefinition;
28: import org.overture.ast.definitions.AEqualsDefinition;
29: import org.overture.ast.definitions.AExplicitFunctionDefinition;
30: import org.overture.ast.definitions.AExplicitOperationDefinition;
31: import org.overture.ast.definitions.AExternalDefinition;
32: import org.overture.ast.definitions.AImplicitFunctionDefinition;
33: import org.overture.ast.definitions.AImplicitOperationDefinition;
34: import org.overture.ast.definitions.AImportedDefinition;
35: import org.overture.ast.definitions.AInheritedDefinition;
36: import org.overture.ast.definitions.AInstanceVariableDefinition;
37: import org.overture.ast.definitions.ALocalDefinition;
38: import org.overture.ast.definitions.AMultiBindListDefinition;
39: import org.overture.ast.definitions.AMutexSyncDefinition;
40: import org.overture.ast.definitions.ANamedTraceDefinition;
41: import org.overture.ast.definitions.APerSyncDefinition;
42: import org.overture.ast.definitions.ARenamedDefinition;
43: import org.overture.ast.definitions.AStateDefinition;
44: import org.overture.ast.definitions.AThreadDefinition;
45: import org.overture.ast.definitions.ATypeDefinition;
46: import org.overture.ast.definitions.AUntypedDefinition;
47: import org.overture.ast.definitions.AValueDefinition;
48: import org.overture.ast.definitions.PDefinition;
49: import org.overture.ast.definitions.SClassDefinition;
50: import org.overture.ast.node.INode;
51: import org.overture.typechecker.assistant.ITypeCheckerAssistantFactory;
52:
53: /**
54: * This class implements a way to find the kind of a node in the AST
55: *
56: * @author kel
57: */
58:•public class KindFinder extends AnswerAdaptor<String>
59: {
60:
61:         protected ITypeCheckerAssistantFactory af;
62:
63:         public KindFinder(ITypeCheckerAssistantFactory af)
64:         {
65:                 this.af = af;
66:         }
67:
68:         @Override
69:         public String caseAAssignmentDefinition(AAssignmentDefinition node)
70:                         throws AnalysisException
71:         {
72:                 return "assignable variable";
73:         }
74:
75:         @Override
76:         public String defaultSClassDefinition(SClassDefinition node)
77:                         throws AnalysisException
78:         {
79:                 return "class";
80:         }
81:
82:         @Override
83:         public String caseAClassInvariantDefinition(AClassInvariantDefinition node)
84:                         throws AnalysisException
85:         {
86:                 return "invariant";
87:         }
88:
89:         @Override
90:         public String caseAEqualsDefinition(AEqualsDefinition node)
91:                         throws AnalysisException
92:         {
93:                 return "equals";
94:         }
95:
96:         @Override
97:         public String caseAExplicitFunctionDefinition(
98:                         AExplicitFunctionDefinition node) throws AnalysisException
99:         {
100:                 return "explicit function";
101:         }
102:
103:         @Override
104:         public String caseAExplicitOperationDefinition(
105:                         AExplicitOperationDefinition node) throws AnalysisException
106:         {
107:                 return "explicit operation";
108:         }
109:
110:         @Override
111:         public String caseAExternalDefinition(AExternalDefinition node)
112:                         throws AnalysisException
113:         {
114:                 return "external";
115:         }
116:
117:         @Override
118:         public String caseAImplicitFunctionDefinition(
119:                         AImplicitFunctionDefinition node) throws AnalysisException
120:         {
121:                 return "implicit function";
122:         }
123:
124:         @Override
125:         public String caseAImplicitOperationDefinition(
126:                         AImplicitOperationDefinition node) throws AnalysisException
127:         {
128:                 return "implicit operation";
129:         }
130:
131:         @Override
132:         public String caseAImportedDefinition(AImportedDefinition node)
133:                         throws AnalysisException
134:         {
135:                 return "import";
136:         }
137:
138:         @Override
139:         public String caseAInheritedDefinition(AInheritedDefinition node)
140:                         throws AnalysisException
141:         {
142:                 return node.getSuperdef().apply(THIS);
143:         }
144:
145:         @Override
146:         public String caseAInstanceVariableDefinition(
147:                         AInstanceVariableDefinition node) throws AnalysisException
148:         {
149:                 return "instance variable";
150:         }
151:
152:         @Override
153:         public String caseALocalDefinition(ALocalDefinition node)
154:                         throws AnalysisException
155:         {
156:                 return "local";
157:         }
158:
159:         @Override
160:         public String caseAMultiBindListDefinition(AMultiBindListDefinition node)
161:                         throws AnalysisException
162:         {
163:                 return "bind";
164:         }
165:
166:         @Override
167:         public String caseAMutexSyncDefinition(AMutexSyncDefinition node)
168:                         throws AnalysisException
169:         {
170:                 return "mutex predicate";
171:         }
172:
173:         @Override
174:         public String caseANamedTraceDefinition(ANamedTraceDefinition node)
175:                         throws AnalysisException
176:         {
177:                 return "trace";
178:         }
179:
180:         @Override
181:         public String caseAPerSyncDefinition(APerSyncDefinition node)
182:                         throws AnalysisException
183:         {
184:                 return "permission predicate";
185:         }
186:
187:         @Override
188:         public String caseARenamedDefinition(ARenamedDefinition node)
189:                         throws AnalysisException
190:         {
191:                 return node.getDef().apply(THIS);
192:         }
193:
194:         @Override
195:         public String caseAStateDefinition(AStateDefinition node)
196:                         throws AnalysisException
197:         {
198:                 return "state";
199:         }
200:
201:         @Override
202:         public String caseAThreadDefinition(AThreadDefinition node)
203:                         throws AnalysisException
204:         {
205:                 return "thread";
206:         }
207:
208:         @Override
209:         public String caseATypeDefinition(ATypeDefinition node)
210:                         throws AnalysisException
211:         {
212:                 return "type";
213:         }
214:
215:         @Override
216:         public String caseAUntypedDefinition(AUntypedDefinition node)
217:                         throws AnalysisException
218:         {
219:                 return "untyped";
220:         }
221:
222:         @Override
223:         public String caseAValueDefinition(AValueDefinition node)
224:                         throws AnalysisException
225:         {
226:                 return "value";
227:         }
228:
229:         @Override
230:         public String defaultPDefinition(PDefinition node) throws AnalysisException
231:         {
232:                 return null;
233:         }
234:
235:         @Override
236:         public String createNewReturnValue(INode node)
237:         {
238:•                assert false : "should not happen";
239:                 return null;
240:         }
241:
242:         @Override
243:         public String createNewReturnValue(Object node)
244:         {
245:•                assert false : "should not happen";
246:                 return null;
247:         }
248:
249: }