1 package net.sourceforge.pmd.ast;
2
3 public class SimpleJavaNode extends SimpleNode implements JavaNode {
4
5 public SimpleJavaNode(JavaParser p, int i) {
6 super(p, i);
7 }
8
9 public SimpleJavaNode(int i) {
10 super(i);
11 }
12
13 public void jjtOpen() {
14 if (beginLine == -1 && parser.token.next != null) {
15 beginLine = parser.token.next.beginLine;
16 beginColumn = parser.token.next.beginColumn;
17 }
18 }
19
20 public void jjtClose() {
21 if (beginLine == -1 && (children == null || children.length == 0)) {
22 beginColumn = parser.token.beginColumn;
23 }
24 if (beginLine == -1) {
25 beginLine = parser.token.beginLine;
26 }
27 endLine = parser.token.endLine;
28 endColumn = parser.token.endColumn;
29 }
30
31 /***
32 * Accept the visitor. *
33 */
34 public Object jjtAccept(JavaParserVisitor visitor, Object data) {
35 return visitor.visit(this, data);
36 }
37
38 /***
39 * Accept the visitor. *
40 */
41 public Object childrenAccept(JavaParserVisitor visitor, Object data) {
42 if (children != null) {
43 for (int i = 0; i < children.length; ++i) {
44 ((JavaNode) children[i]).jjtAccept(visitor, data);
45 }
46 }
47 return data;
48 }
49
50
51
52
53
54
55
56
57
58
59
60 public String toString() {
61 return JavaParserTreeConstants.jjtNodeName[id];
62 }
63 }