1 package net.sourceforge.phpdt.internal.compiler.ast;
4 import java.util.ArrayList;
7 * A ConditionalExpression is like that : booleanExpression ? trueValue : falseValue;
8 * @author Matthieu Casanova
10 public class ConditionalExpression extends OperatorExpression {
12 public Expression condition, valueIfTrue, valueIfFalse;
14 public ConditionalExpression(final Expression condition,
15 final Expression valueIfTrue,
16 final Expression valueIfFalse) {
17 super(-1, condition.sourceStart, valueIfFalse.sourceEnd);
18 this.condition = condition;
19 this.valueIfTrue = valueIfTrue;
20 this.valueIfFalse = valueIfFalse;
23 public String toStringExpression() {
24 final StringBuffer buff = new StringBuffer("(");
25 buff.append(condition.toStringExpression());
27 buff.append(valueIfTrue.toStringExpression());
29 buff.append(valueIfFalse.toStringExpression());
30 return buff.toString();
34 * Get the variables from outside (parameters, globals ...)
36 public void getOutsideVariable(final List list) {
40 * get the modified variables.
42 public void getModifiedVariable(final List list) {
43 condition.getModifiedVariable(list);
44 valueIfTrue.getModifiedVariable(list);
45 valueIfFalse.getModifiedVariable(list);
49 * Get the variables used.
51 public void getUsedVariable(final List list) {
52 condition.getUsedVariable(list);
53 valueIfTrue.getUsedVariable(list);
54 valueIfFalse.getUsedVariable(list);