001 package serp.bytecode.visitor;
002
003 import serp.bytecode.*;
004 import serp.bytecode.Deprecated;
005 import serp.bytecode.lowlevel.*;
006
007
008 /**
009 * Base class for visitors on a bytecode entity. The public {@link #visit}
010 * method will traverse the object graph of the given entity, calling the
011 * <code>enter*</code> and <code>exit*</code> methods as it visits each
012 * object. The traversal is done depth-first. Subclasses should override
013 * only the methods for visiting the entities they are interested in.
014 * Whenever there is a general method (i.e. <code>enter/exitEntry</code>) as
015 * well as a more specific one (i.e. <code>enter/exitStringEntry</code>), the
016 * more general method will be called first, followed by a call on the correct
017 * specific method. Most subclasses will override either the general or
018 * specific cases, but not both.
019 *
020 * @author Abe White
021 */
022 public class BCVisitor {
023 /**
024 * Visit the given entity.
025 */
026 public void visit(VisitAcceptor obj) {
027 if (obj == null)
028 return;
029 obj.acceptVisit(this);
030 }
031
032 public void enterProject(Project obj) {
033 }
034
035 public void exitProject(Project obj) {
036 }
037
038 public void enterBCClass(BCClass obj) {
039 }
040
041 public void exitBCClass(BCClass obj) {
042 }
043
044 public void enterBCMember(BCMember obj) {
045 }
046
047 public void exitBCMember(BCMember obj) {
048 }
049
050 public void enterBCField(BCField obj) {
051 }
052
053 public void exitBCField(BCField obj) {
054 }
055
056 public void enterBCMethod(BCMethod obj) {
057 }
058
059 public void exitBCMethod(BCMethod obj) {
060 }
061
062 public void enterAttribute(Attribute obj) {
063 }
064
065 public void exitAttribute(Attribute obj) {
066 }
067
068 public void enterConstantValue(ConstantValue obj) {
069 }
070
071 public void exitConstantValue(ConstantValue obj) {
072 }
073
074 public void enterDeprecated(Deprecated obj) {
075 }
076
077 public void exitDeprecated(Deprecated obj) {
078 }
079
080 public void enterExceptions(Exceptions obj) {
081 }
082
083 public void exitExceptions(Exceptions obj) {
084 }
085
086 public void enterInnerClasses(InnerClasses obj) {
087 }
088
089 public void exitInnerClasses(InnerClasses obj) {
090 }
091
092 public void enterLineNumberTable(LineNumberTable obj) {
093 }
094
095 public void exitLineNumberTable(LineNumberTable obj) {
096 }
097
098 public void enterLocalVariableTable(LocalVariableTable obj) {
099 }
100
101 public void exitLocalVariableTable(LocalVariableTable obj) {
102 }
103
104 public void enterLocalVariableTypeTable(LocalVariableTypeTable obj) {
105 }
106
107 public void exitLocalVariableTypeTable(LocalVariableTypeTable obj) {
108 }
109
110 public void enterAnnotations(Annotations obj) {
111 }
112
113 public void exitAnnotations(Annotations obj) {
114 }
115
116 public void enterAnnotation(Annotation obj) {
117 }
118
119 public void exitAnnotation(Annotation obj) {
120 }
121
122 public void enterAnnotationProperty(Annotation.Property obj) {
123 }
124
125 public void exitAnnotationProperty(Annotation.Property obj) {
126 }
127
128 public void enterSourceFile(SourceFile obj) {
129 }
130
131 public void exitSourceFile(SourceFile obj) {
132 }
133
134 public void enterSynthetic(Synthetic obj) {
135 }
136
137 public void exitSynthetic(Synthetic obj) {
138 }
139
140 public void enterUnknownAttribute(UnknownAttribute obj) {
141 }
142
143 public void exitUnknownAttribute(UnknownAttribute obj) {
144 }
145
146 public void enterCode(Code obj) {
147 }
148
149 public void exitCode(Code obj) {
150 }
151
152 public void enterExceptionHandler(ExceptionHandler obj) {
153 }
154
155 public void exitExceptionHandler(ExceptionHandler obj) {
156 }
157
158 public void enterInnerClass(InnerClass obj) {
159 }
160
161 public void exitInnerClass(InnerClass obj) {
162 }
163
164 public void enterLineNumber(LineNumber obj) {
165 }
166
167 public void exitLineNumber(LineNumber obj) {
168 }
169
170 public void enterLocalVariable(LocalVariable obj) {
171 }
172
173 public void exitLocalVariable(LocalVariable obj) {
174 }
175
176 public void enterLocalVariableType(LocalVariableType obj) {
177 }
178
179 public void exitLocalVariableType(LocalVariableType obj) {
180 }
181
182 public void enterInstruction(Instruction obj) {
183 }
184
185 public void exitInstruction(Instruction obj) {
186 }
187
188 public void enterArrayLoadInstruction(ArrayLoadInstruction obj) {
189 }
190
191 public void exitArrayLoadInstruction(ArrayLoadInstruction obj) {
192 }
193
194 public void enterArrayStoreInstruction(ArrayStoreInstruction obj) {
195 }
196
197 public void exitArrayStoreInstruction(ArrayStoreInstruction obj) {
198 }
199
200 public void enterClassInstruction(ClassInstruction obj) {
201 }
202
203 public void exitClassInstruction(ClassInstruction obj) {
204 }
205
206 public void enterConstantInstruction(ConstantInstruction obj) {
207 }
208
209 public void exitConstantInstruction(ConstantInstruction obj) {
210 }
211
212 public void enterConvertInstruction(ConvertInstruction obj) {
213 }
214
215 public void exitConvertInstruction(ConvertInstruction obj) {
216 }
217
218 public void enterGetFieldInstruction(GetFieldInstruction obj) {
219 }
220
221 public void exitGetFieldInstruction(GetFieldInstruction obj) {
222 }
223
224 public void enterIIncInstruction(IIncInstruction obj) {
225 }
226
227 public void exitIIncInstruction(IIncInstruction obj) {
228 }
229
230 public void enterJumpInstruction(JumpInstruction obj) {
231 }
232
233 public void exitJumpInstruction(JumpInstruction obj) {
234 }
235
236 public void enterIfInstruction(IfInstruction obj) {
237 }
238
239 public void exitIfInstruction(IfInstruction obj) {
240 }
241
242 public void enterLoadInstruction(LoadInstruction obj) {
243 }
244
245 public void exitLoadInstruction(LoadInstruction obj) {
246 }
247
248 public void enterLookupSwitchInstruction(LookupSwitchInstruction obj) {
249 }
250
251 public void exitLookupSwitchInstruction(LookupSwitchInstruction obj) {
252 }
253
254 public void enterMathInstruction(MathInstruction obj) {
255 }
256
257 public void exitMathInstruction(MathInstruction obj) {
258 }
259
260 public void enterMethodInstruction(MethodInstruction obj) {
261 }
262
263 public void exitMethodInstruction(MethodInstruction obj) {
264 }
265
266 public void enterMultiANewArrayInstruction(MultiANewArrayInstruction obj) {
267 }
268
269 public void exitMultiANewArrayInstruction(MultiANewArrayInstruction obj) {
270 }
271
272 public void enterNewArrayInstruction(NewArrayInstruction obj) {
273 }
274
275 public void exitNewArrayInstruction(NewArrayInstruction obj) {
276 }
277
278 public void enterPutFieldInstruction(PutFieldInstruction obj) {
279 }
280
281 public void exitPutFieldInstruction(PutFieldInstruction obj) {
282 }
283
284 public void enterRetInstruction(RetInstruction obj) {
285 }
286
287 public void exitRetInstruction(RetInstruction obj) {
288 }
289
290 public void enterReturnInstruction(ReturnInstruction obj) {
291 }
292
293 public void exitReturnInstruction(ReturnInstruction obj) {
294 }
295
296 public void enterStackInstruction(StackInstruction obj) {
297 }
298
299 public void exitStackInstruction(StackInstruction obj) {
300 }
301
302 public void enterStoreInstruction(StoreInstruction obj) {
303 }
304
305 public void exitStoreInstruction(StoreInstruction obj) {
306 }
307
308 public void enterTableSwitchInstruction(TableSwitchInstruction obj) {
309 }
310
311 public void exitTableSwitchInstruction(TableSwitchInstruction obj) {
312 }
313
314 public void enterWideInstruction(WideInstruction obj) {
315 }
316
317 public void exitWideInstruction(WideInstruction obj) {
318 }
319
320 public void enterMonitorEnterInstruction(MonitorEnterInstruction obj) {
321 }
322
323 public void exitMonitorEnterInstruction(MonitorEnterInstruction obj) {
324 }
325
326 public void enterMonitorExitInstruction(MonitorExitInstruction obj) {
327 }
328
329 public void exitMonitorExitInstruction(MonitorExitInstruction obj) {
330 }
331
332 public void enterCmpInstruction(CmpInstruction obj) {
333 }
334
335 public void exitCmpInstruction(CmpInstruction obj) {
336 }
337
338 public void enterConstantPool(ConstantPool obj) {
339 }
340
341 public void exitConstantPool(ConstantPool obj) {
342 }
343
344 public void enterEntry(Entry obj) {
345 }
346
347 public void exitEntry(Entry obj) {
348 }
349
350 public void enterClassEntry(ClassEntry obj) {
351 }
352
353 public void exitClassEntry(ClassEntry obj) {
354 }
355
356 public void enterDoubleEntry(DoubleEntry obj) {
357 }
358
359 public void exitDoubleEntry(DoubleEntry obj) {
360 }
361
362 public void enterFieldEntry(FieldEntry obj) {
363 }
364
365 public void exitFieldEntry(FieldEntry obj) {
366 }
367
368 public void enterFloatEntry(FloatEntry obj) {
369 }
370
371 public void exitFloatEntry(FloatEntry obj) {
372 }
373
374 public void enterIntEntry(IntEntry obj) {
375 }
376
377 public void exitIntEntry(IntEntry obj) {
378 }
379
380 public void enterInterfaceMethodEntry(InterfaceMethodEntry obj) {
381 }
382
383 public void exitInterfaceMethodEntry(InterfaceMethodEntry obj) {
384 }
385
386 public void enterLongEntry(LongEntry obj) {
387 }
388
389 public void exitLongEntry(LongEntry obj) {
390 }
391
392 public void enterMethodEntry(MethodEntry obj) {
393 }
394
395 public void exitMethodEntry(MethodEntry obj) {
396 }
397
398 public void enterNameAndTypeEntry(NameAndTypeEntry obj) {
399 }
400
401 public void exitNameAndTypeEntry(NameAndTypeEntry obj) {
402 }
403
404 public void enterStringEntry(StringEntry obj) {
405 }
406
407 public void exitStringEntry(StringEntry obj) {
408 }
409
410 public void enterUTF8Entry(UTF8Entry obj) {
411 }
412
413 public void exitUTF8Entry(UTF8Entry obj) {
414 }
415 }