1 package net.sourceforge.phpdt.internal.compiler.ast;
8 * @author Matthieu Casanova
10 public class Block extends Statement {
11 public Statement[] statements;
13 public boolean isEmptyBlock() {
14 return statements == null;
17 public String toString(int tab) {
18 final String s = tabString(tab);
19 final StringBuffer buff = new StringBuffer(s);
20 if (this.statements == null) {
21 buff.append("{\n"); //$NON-NLS-1$
23 buff.append("}"); //$NON-NLS-1$
26 buff.append("{\n"); //$NON-NLS-1$
27 buff.append(this.toStringStatements(tab));
29 buff.append("}"); //$NON-NLS-1$
33 public String toStringStatements(int tab) {
34 if (this.statements == null)
35 return ""; //$NON-NLS-1$
36 StringBuffer buffer = new StringBuffer();
37 for (int i = 0; i < statements.length; i++) {
38 buffer.append(statements[i].toString(tab + 1));
39 if (statements[i] instanceof Block) {
40 buffer.append("\n"); //$NON-NLS-1$
42 buffer.append(";\n"); //$NON-NLS-1$
45 return buffer.toString();