1 package net.sourceforge.phpdt.internal.compiler.ast;
4 * A ConditionalExpression is like that : booleanExpression ? trueValue : falseValue;
5 * @author Matthieu Casanova
7 public class ConditionalExpression extends OperatorExpression {
9 public Expression condition, valueIfTrue, valueIfFalse;
11 public ConditionalExpression(Expression condition,
12 Expression valueIfTrue,
13 Expression valueIfFalse) {
14 super(-1, condition.sourceStart, valueIfFalse.sourceEnd);
15 this.condition = condition;
16 this.valueIfTrue = valueIfTrue;
17 this.valueIfFalse = valueIfFalse;
20 public String toStringExpression() {
21 final StringBuffer buff = new StringBuffer("(");
22 buff.append(condition.toStringExpression());
24 buff.append(valueIfTrue.toStringExpression());
26 buff.append(valueIfFalse.toStringExpression());
27 return buff.toString();