01: /*
02: * Author: Mike Atkinson
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package net.sourceforge.jrefactory.ast;
10:
11: import net.sourceforge.jrefactory.parser.JavaParser;
12: import net.sourceforge.jrefactory.parser.JavaParserVisitor;
13:
14: /**
15: * Statement that catches exceptions
16: *
17: * @author Mike Atkinson
18: * @since jRefactory 2.9.0, created October 16, 2003
19: */
20: public class ASTTryStatement extends SimpleNode {
21: private boolean hasCatch;
22: private boolean hasFinally;
23:
24: /**
25: * Constructor for the ASTTryStatement node.
26: *
27: * @param identifier The id of this node (JJTTRYSTATEMENT).
28: */
29: public ASTTryStatement(int identifier) {
30: super (identifier);
31: }
32:
33: /**
34: * Constructor for the ASTTryStatement node.
35: *
36: * @param parser The JavaParser that created this ASTTryStatement node.
37: * @param identifier The id of this node (JJTTRYSTATEMENT).
38: */
39: public ASTTryStatement(JavaParser parser, int identifier) {
40: super (parser, identifier);
41: }
42:
43: /** This try statement has <code>catch</code> block. */
44: public void setHasCatch() {
45: hasCatch = true;
46: }
47:
48: /** This try statement has <code>finally</code> block. */
49: public void setHasFinally() {
50: hasFinally = true;
51: }
52:
53: /**
54: * Accept the visitor.
55: *
56: * @param visitor An implementation of JavaParserVisitor that processes the ASTTryStatement node.
57: * @param data Some data being passed between the visitor methods.
58: * @return Usually the data parameter (possibly modified).
59: */
60: public Object jjtAccept(JavaParserVisitor visitor, Object data) {
61: return visitor.visit(this , data);
62: }
63:
64: /**
65: * Does the try statement have a <code>catch</code> block.
66: *
67: * @return <code>true</code> if the try statement has a <code>catch</code> block.
68: */
69: public boolean hasCatch() {
70: return hasCatch;
71: }
72:
73: /**
74: * Does the try statement have a <code>finally</code> block.
75: *
76: * @return <code>true</code> if the try statement has a <code>finally</code> block.
77: */
78: public boolean hasFinally() {
79: return hasFinally;
80: }
81: }
|