package net.sourceforge.phpdt.internal.compiler.ast; /** * @author Matthieu Casanova */ public class IfStatement extends Statement { public Expression condition; public ElseIf[] elseifs; public Else els; public IfStatement(Expression condition, ElseIf[] elseifs, Else els, int sourceStart, int sourceEnd) { super(sourceStart, sourceEnd); this.condition = condition; this.elseifs = elseifs; this.els = els; } /** * Return the object into String. * @param tab how many tabs (not used here * @return a String */ public String toString(int tab) { final StringBuffer buff = new StringBuffer(tabString(tab)); buff.append("if ("); buff.append(condition.toStringExpression()).append(") "); for (int i = 0; i < elseifs.length; i++) { ElseIf elseif = elseifs[i]; buff.append(elseif.toString(tab+1)); buff.append('\n'); } if (els != null) { buff.append(els.toString(tab+1)); buff.append('\n'); } return buff.toString(); } }