1 /***
2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 */
4 package net.sourceforge.pmd.symboltable;
5
6 import net.sourceforge.pmd.ast.ASTFormalParameter;
7 import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
8 import net.sourceforge.pmd.ast.AccessNode;
9
10 public class VariableNameDeclaration extends AbstractNameDeclaration implements NameDeclaration {
11
12 public VariableNameDeclaration(ASTVariableDeclaratorId node) {
13 super(node);
14 }
15
16 public Scope getScope() {
17 return node.getScope().getEnclosingClassScope();
18 }
19
20 public boolean isArray() {
21 return ((ASTVariableDeclaratorId)node).getTypeNode().isArray();
22 }
23
24 public boolean isExceptionBlockParameter() {
25 return ((ASTVariableDeclaratorId) node).isExceptionBlockParameter();
26 }
27
28 public AccessNode getAccessNodeParent() {
29 if (node.jjtGetParent() instanceof ASTFormalParameter) {
30 return (AccessNode)node.jjtGetParent();
31 }
32 return (AccessNode) node.jjtGetParent().jjtGetParent();
33 }
34
35 public boolean equals(Object o) {
36 VariableNameDeclaration n = (VariableNameDeclaration) o;
37 return n.node.getImage().equals(node.getImage());
38 }
39
40 public int hashCode() {
41 return node.getImage().hashCode();
42 }
43
44 public String toString() {
45 return "Variable symbol " + node.getImage() + " line " + node.getBeginLine();
46 }
47 }
This page was automatically generated by Maven