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 |
983
| public ASTMethodDeclaration(JavaParser p, int id) {
|
11 |
983
| super(p, id);
|
12 |
| } |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
2501
| public Object jjtAccept(JavaParserVisitor visitor, Object data) {
|
18 |
2501
| 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 |
| |
31 |
58
| public String getMethodName() {
|
32 |
58
| ASTMethodDeclarator md = (ASTMethodDeclarator) getFirstChildOfType(ASTMethodDeclarator.class);
|
33 |
58
| if (md != null)
|
34 |
58
| return md.getImage();
|
35 |
0
| return null;
|
36 |
| } |
37 |
| |
38 |
6
| public boolean isSyntacticallyPublic() {
|
39 |
6
| return super.isPublic();
|
40 |
| } |
41 |
| |
42 |
2
| public boolean isSyntacticallyAbstract() {
|
43 |
2
| return super.isAbstract();
|
44 |
| } |
45 |
| |
46 |
26
| public boolean isPublic() {
|
47 |
26
| if (isInterfaceMember()) {
|
48 |
0
| return true;
|
49 |
| } |
50 |
26
| return super.isPublic();
|
51 |
| } |
52 |
| |
53 |
64
| public boolean isAbstract() {
|
54 |
64
| if (isInterfaceMember()) {
|
55 |
0
| return true;
|
56 |
| } |
57 |
64
| return super.isAbstract();
|
58 |
| } |
59 |
| |
60 |
90
| public boolean isInterfaceMember() {
|
61 |
90
| ASTClassOrInterfaceDeclaration clz = (ASTClassOrInterfaceDeclaration) getFirstParentOfType(ASTClassOrInterfaceDeclaration.class);
|
62 |
90
| return clz != null && clz.isInterface();
|
63 |
| } |
64 |
| |
65 |
6
| public boolean isVoid() {
|
66 |
6
| return ((ASTResultType) getFirstChildOfType(ASTResultType.class)).isVoid();
|
67 |
| } |
68 |
| |
69 |
14
| public ASTResultType getResultType() {
|
70 |
14
| return (ASTResultType) getFirstChildOfType(ASTResultType.class);
|
71 |
| } |
72 |
| |
73 |
22
| public ASTBlock getBlock() {
|
74 |
22
| if (this.jjtGetChild(2) instanceof ASTBlock) {
|
75 |
21
| return (ASTBlock) this.jjtGetChild(2);
|
76 |
| } |
77 |
1
| if (jjtGetNumChildren() > 3) {
|
78 |
1
| if (this.jjtGetChild(3) instanceof ASTBlock) {
|
79 |
1
| return (ASTBlock) this.jjtGetChild(3);
|
80 |
| } |
81 |
| } |
82 |
0
| return null;
|
83 |
| } |
84 |
| } |