|
1 |
| |
|
2 |
| |
|
3 |
| package net.sourceforge.pmd.ast; |
|
4 |
| |
|
5 |
| public class ASTMethodDeclaration extends AccessNode { |
|
6 |
4
| public ASTMethodDeclaration(int id) {
|
|
7 |
4
| super(id);
|
|
8 |
| } |
|
9 |
| |
|
10 |
731
| public ASTMethodDeclaration(JavaParser p, int id) {
|
|
11 |
731
| super(p, id);
|
|
12 |
| } |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
1843
| public Object jjtAccept(JavaParserVisitor visitor, Object data) {
|
|
18 |
1843
| return visitor.visit(this, data);
|
|
19 |
| } |
|
20 |
| |
|
21 |
0
| public void dump(String prefix) {
|
|
22 |
0
| System.out.println(collectDumpedModifiers(prefix));
|
|
23 |
0
| dumpChildren(prefix);
|
|
24 |
| } |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
58
| public String getMethodName() {
|
|
31 |
58
| ASTMethodDeclarator md = (ASTMethodDeclarator) getFirstChildOfType(ASTMethodDeclarator.class);
|
|
32 |
58
| if (md!=null)
|
|
33 |
58
| return md.getImage();
|
|
34 |
0
| return null;
|
|
35 |
| } |
|
36 |
| |
|
37 |
6
| public boolean isVoid() {
|
|
38 |
6
| return ((ASTResultType)getFirstChildOfType(ASTResultType.class)).isVoid();
|
|
39 |
| } |
|
40 |
| |
|
41 |
13
| public ASTResultType getResultType() {
|
|
42 |
13
| return (ASTResultType)getFirstChildOfType(ASTResultType.class);
|
|
43 |
| } |
|
44 |
| |
|
45 |
21
| public ASTBlock getBlock() {
|
|
46 |
21
| if (this.jjtGetChild(2) instanceof ASTBlock) {
|
|
47 |
20
| return (ASTBlock)this.jjtGetChild(2);
|
|
48 |
| } |
|
49 |
1
| if (jjtGetNumChildren() > 3) {
|
|
50 |
1
| if (this.jjtGetChild(3) instanceof ASTBlock) {
|
|
51 |
1
| return (ASTBlock)this.jjtGetChild(3);
|
|
52 |
| } |
|
53 |
| } |
|
54 |
0
| return null;
|
|
55 |
| } |
|
56 |
| } |