1 |
| |
2 |
| |
3 |
| package net.sourceforge.pmd.ast; |
4 |
| |
5 |
| public class ASTFormalParameter extends AccessNode implements Dimensionable { |
6 |
1
| public ASTFormalParameter(int id) {
|
7 |
1
| super(id);
|
8 |
| } |
9 |
| |
10 |
294
| public ASTFormalParameter(JavaParser p, int id) {
|
11 |
294
| super(p, id);
|
12 |
| } |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
690
| public Object jjtAccept(JavaParserVisitor visitor, Object data) {
|
18 |
690
| return visitor.visit(this, data);
|
19 |
| } |
20 |
| |
21 |
13
| public boolean isArray() {
|
22 |
13
| return checkType() + checkDecl() > 0;
|
23 |
| } |
24 |
| |
25 |
0
| public int getArrayDepth() {
|
26 |
0
| if (!isArray()) {
|
27 |
0
| return 0;
|
28 |
| } |
29 |
0
| return checkType() + checkDecl();
|
30 |
| } |
31 |
| |
32 |
13
| private int checkType() {
|
33 |
13
| if (jjtGetNumChildren() == 0 || !(jjtGetChild(0) instanceof ASTType)) {
|
34 |
0
| return 0;
|
35 |
| } |
36 |
13
| return ((ASTType) jjtGetChild(0)).getArrayDepth();
|
37 |
| } |
38 |
| |
39 |
13
| private int checkDecl() {
|
40 |
13
| if (jjtGetNumChildren() < 2 || !(jjtGetChild(1) instanceof ASTVariableDeclarator)) {
|
41 |
13
| return 0;
|
42 |
| } |
43 |
0
| return ((ASTVariableDeclaratorId) (jjtGetChild(1).jjtGetChild(0))).getArrayDepth();
|
44 |
| } |
45 |
| |
46 |
0
| public void dump(String prefix) {
|
47 |
0
| System.out.println(collectDumpedModifiers(prefix));
|
48 |
0
| dumpChildren(prefix);
|
49 |
| } |
50 |
| |
51 |
| } |