1 package net.sourceforge.phpdt.internal.compiler.ast;
8 * @author Matthieu Casanova
10 public class Block extends Statement {
12 /** An array of statements inside the block. */
13 public Statement[] statements;
17 * @param statements the statements
18 * @param sourceStart starting offset
19 * @param sourceEnd ending offset
21 public Block(Statement[] statements,int sourceStart, int sourceEnd) {
22 super(sourceStart, sourceEnd);
23 this.statements = statements;
26 public boolean isEmptyBlock() {
27 return statements == null;
31 * Return the block as String.
32 * @param tab how many tabs
33 * @return the string representation of the block
35 public String toString(int tab) {
36 final String s = AstNode.tabString(tab);
37 final StringBuffer buff = new StringBuffer(s);
38 buff.append("{\n"); //$NON-NLS-1$
39 if (this.statements == null) {
40 for (int i = 0; i < statements.length; i++) {
41 buff.append(statements[i].toString(tab+1)).append(";\n");//$NON-NLS-1$
42 buff.append(statements[i].getClass().getName()).append(";\n");//$NON-NLS-1$
45 buff.append("}\n"); //$NON-NLS-1$
46 return buff.toString();