1 package net.sourceforge.phpdt.internal.compiler.ast;
8 * @author Matthieu Casanova
10 public final class Else extends Statement {
12 /** the statements. */
13 private final 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 statements = new Statement[1];
39 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 * @param list the list where we will put variables
63 public void getOutsideVariable(final List list) {
64 for (int i = 0; i < statements.length; i++) {
65 statements[i].getOutsideVariable(list);
70 * get the modified variables.
72 * @param list the list where we will put variables
74 public void getModifiedVariable(final List list) {
75 for (int i = 0; i < statements.length; i++) {
76 statements[i].getModifiedVariable(list);
81 * Get the variables used.
83 * @param list the list where we will put variables
85 public void getUsedVariable(final List list) {
86 for (int i = 0; i < statements.length; i++) {
87 statements[i].getUsedVariable(list);