1 package net.sourceforge.phpdt.internal.compiler.ast;
8 * @author Matthieu Casanova
10 public class Else extends Statement {
12 /** the statements. */
13 public Statement[] statements;
16 * An else statement bad version ( : endif).
17 * @param statements the statements
18 * @param sourceStart the starting offset
19 * @param sourceEnd the ending offset
21 public Else(final Statement[] statements,
22 final int sourceStart,
23 final int sourceEnd) {
24 super(sourceStart, sourceEnd);
25 this.statements = statements;
29 * An else statement good version
30 * @param statement the statement (it could be a block)
31 * @param sourceStart the starting offset
32 * @param sourceEnd the ending offset
34 public Else(final Statement statement,
35 final int sourceStart,
36 final int sourceEnd) {
37 super(sourceStart, sourceEnd);
38 this.statements = new Statement[1];
39 this.statements[0] = statement;
43 * Return the object into String.
44 * @param tab how many tabs (not used here
47 public String toString(final int tab) {
48 final StringBuffer buff = new StringBuffer(tabString(tab));
49 buff.append("else \n");//$NON-NLS-1$
51 for (int i = 0; i < statements.length; i++) {
52 statement = statements[i];
53 buff.append(statement.toString(tab + 1)).append("\n");//$NON-NLS-1$
55 return buff.toString();
59 * Get the variables from outside (parameters, globals ...)
61 public void getOutsideVariable(final List list) {
62 for (int i = 0; i < statements.length; i++) {
63 statements[i].getOutsideVariable(list);
68 * get the modified variables.
70 public void getModifiedVariable(final List list) {
71 for (int i = 0; i < statements.length; i++) {
72 statements[i].getModifiedVariable(list);
77 * Get the variables used.
79 public void getUsedVariable(final List list) {
80 for (int i = 0; i < statements.length; i++) {
81 statements[i].getUsedVariable(list);