summaryrefslogtreecommitdiff
path: root/src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java
diff options
context:
space:
mode:
authorKenny Ballou <kballou@devnulllabs.io>2018-11-19 22:59:50 -0700
committerKenny Ballou <kballou@devnulllabs.io>2018-11-19 22:59:50 -0700
commitea3e1b949dcbdc09518f17eee0bcf21d41d76896 (patch)
tree7ec7a7fb4df67815a9b7bb0e4d95d67c4050e2a2 /src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java
downloadopenjava-ea3e1b949dcbdc09518f17eee0bcf21d41d76896.tar.gz
openjava-ea3e1b949dcbdc09518f17eee0bcf21d41d76896.tar.xz
OJ (aka OpenJava) modernization/mirroring
Signed-off-by: Kenny Ballou <kballou@devnulllabs.io>
Diffstat (limited to 'src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java')
-rw-r--r--src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java b/src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java
new file mode 100644
index 0000000..b1b3d25
--- /dev/null
+++ b/src/main/java/io/devnulllabs/openjava/ptree/TryStatement.java
@@ -0,0 +1,129 @@
+/*
+ * TryStatement.java 1.0
+ *
+ * Jun 20, 1997 mich
+ * Sep 29, 1997 mich
+ *
+ * @see io.devnulllabs.openjava.ptree.ParseTree
+ * @version 1.0 last updated: Sep 29, 1997
+ * @author Michiaki Tatsubori
+ */
+package io.devnulllabs.openjava.ptree;
+
+import io.devnulllabs.openjava.ptree.util.ParseTreeVisitor;
+
+/**
+ * The <code>TryStatement</code> class represents
+ * a try statement node of parse tree.
+ *
+ * @see io.devnulllabs.openjava.ptree.ParseTree
+ * @see io.devnulllabs.openjava.ptree.NonLeaf
+ * @see io.devnulllabs.openjava.ptree.Statement
+ * @see io.devnulllabs.openjava.ptree.StatementList
+ * @see io.devnulllabs.openjava.ptree.CatchList
+ */
+public class TryStatement extends NonLeaf implements Statement, ParseTree {
+
+ /**
+ * Allocates a new TryStatement object.
+ *
+ * @param the statement list of the body of this try statement.
+ * @param the catch block list of this try statement.
+ * @param the statement list of the finally block.
+ */
+ public TryStatement(
+ StatementList stmts,
+ CatchList catchlist,
+ StatementList finallee) {
+ super();
+ if (stmts == null)
+ stmts = new StatementList();
+ if (catchlist == null)
+ catchlist = new CatchList();
+ if (finallee == null)
+ finallee = new StatementList();
+ set(stmts, catchlist, finallee);
+ }
+
+ /**
+ * Allocates a new TryStatement object.
+ *
+ * @param the statement list of the body of this try statement.
+ * @param the catch block list of this try statement.
+ */
+ public TryStatement(StatementList stmts, CatchList catchlist) {
+ this(stmts, catchlist, new StatementList());
+ }
+
+ /**
+ * Allocates a new TryStatement object.
+ *
+ * @param the statement list of the body of this try statement.
+ * @param the statement list of the finally block.
+ */
+ public TryStatement(StatementList stmts, StatementList finallee) {
+ this(stmts, new CatchList(), finallee);
+ }
+
+ TryStatement() {
+ }
+
+ /**
+ * Gets the body of this try statement.
+ *
+ * @return the statement list of the body.
+ */
+ public StatementList getBody() {
+ return (StatementList) elementAt(0);
+ }
+
+ /**
+ * Sets the body of this try statement.
+ *
+ * @param stmts the statement list of the body to set.
+ */
+ public void setBody(StatementList stmts) {
+ setElementAt(stmts, 0);
+ }
+
+ /**
+ * Gets the catch block list.
+ *
+ * @return the catch block list.
+ */
+ public CatchList getCatchList() {
+ return (CatchList) elementAt(1);
+ }
+
+ /**
+ * Sets the catch block list.
+ *
+ * @param catchlist the catch block list.
+ */
+ public void setCatchList(CatchList catchlist) {
+ setElementAt(catchlist, 1);
+ }
+
+ /**
+ * Gets the finally body.
+ *
+ * @return the statement list of finally body.
+ */
+ public StatementList getFinallyBody() {
+ return (StatementList) elementAt(2);
+ }
+
+ /**
+ * Sets the finally body.
+ *
+ * @param finallee the statement list of finally body.
+ */
+ public void setFinallyBody(StatementList finallee) {
+ setElementAt(finallee, 2);
+ }
+
+ public void accept(ParseTreeVisitor v) throws ParseTreeException {
+ v.visit(this);
+ }
+
+}