summaryrefslogtreecommitdiff
path: root/src/main/java/io/devnulllabs/openjava/ptree/Block.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/devnulllabs/openjava/ptree/Block.java')
-rw-r--r--src/main/java/io/devnulllabs/openjava/ptree/Block.java71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/io/devnulllabs/openjava/ptree/Block.java b/src/main/java/io/devnulllabs/openjava/ptree/Block.java
new file mode 100644
index 0000000..585a39b
--- /dev/null
+++ b/src/main/java/io/devnulllabs/openjava/ptree/Block.java
@@ -0,0 +1,71 @@
+/*
+ * Block.java 1.0
+ *
+ * Jun 11, 1997 by mich
+ * Aug 29, 1997 by mich
+ *
+ * @see io.devnulllabs.openjava.ptree.ParseTree
+ * @version last updated: Aug 29, 1997
+ * @author Michiaki Tatsubori
+ */
+package io.devnulllabs.openjava.ptree;
+
+import io.devnulllabs.openjava.ptree.util.ParseTreeVisitor;
+
+/**
+ * The Block class represents a node of parse tree
+ * of block statement like :
+ * <br><blockquote><pre>
+ * {
+ * int i = 0;
+ * i = f( i );
+ * }
+ * </pre></blockquote><br>
+ *
+ * @see io.devnulllabs.openjava.ptree.NonLeaf
+ * @see io.devnulllabs.openjava.ptree.Statement
+ */
+public class Block extends NonLeaf implements Statement {
+ /**
+ * Allocates a new object.
+ *
+ * @param stmts statement list.
+ */
+ public Block(StatementList stmts) {
+ super();
+ if (stmts == null)
+ stmts = new StatementList();
+ set(stmts);
+ }
+
+ /**
+ * Allocates a new object with an empty statement list.
+ *
+ */
+ public Block() {
+ this(new StatementList());
+ }
+
+ /**
+ * Gets the statement list of this block.
+ *
+ * @return the statement list.
+ */
+ public StatementList getStatements() {
+ return (StatementList) elementAt(0);
+ }
+
+ /**
+ * Sets the statement list of this block.
+ *
+ * @param stmts the statement list to set.
+ */
+ public void setStatements(StatementList stmts) {
+ setElementAt(stmts, 0);
+ }
+
+ public void accept(ParseTreeVisitor v) throws ParseTreeException {
+ v.visit(this);
+ }
+
+}