01: /* Generated By:JJTree: Do not edit this line. ASTFormalParameter.java */
02: package net.sourceforge.pmd.ast;
03:
04: public class ASTFormalParameter extends AccessNode implements
05: Dimensionable {
06: public ASTFormalParameter(int id) {
07: super (id);
08: }
09:
10: public ASTFormalParameter(JavaParser p, int id) {
11: super (p, id);
12: }
13:
14: public Object jjtAccept(JavaParserVisitor visitor, Object data) {
15: return visitor.visit(this , data);
16: }
17:
18: public boolean isArray() {
19: return checkType() + checkDecl() > 0;
20: }
21:
22: public int getArrayDepth() {
23: if (!isArray()) {
24: return 0;
25: }
26: return checkType() + checkDecl();
27: }
28:
29: private int checkType() {
30: if (jjtGetNumChildren() == 0
31: || !(jjtGetChild(0) instanceof ASTType)) {
32: return 0;
33: }
34: return ((ASTType) jjtGetChild(0)).getArrayDepth();
35: }
36:
37: private int checkDecl() {
38: if (jjtGetNumChildren() < 2
39: || !(jjtGetChild(1) instanceof ASTVariableDeclarator)) {
40: return 0;
41: }
42: return ((ASTVariableDeclaratorId) (jjtGetChild(1)
43: .jjtGetChild(0))).getArrayDepth();
44: }
45:
46: public void dump(String prefix) {
47: System.out.println(collectDumpedModifiers(prefix));
48: dumpChildren(prefix);
49: }
50:
51: }
|