1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * A ConditionalExpression is like that : booleanExpression ? trueValue : falseValue;
7 * @author Matthieu Casanova
9 public class ConditionalExpression extends OperatorExpression {
11 public Expression condition, valueIfTrue, valueIfFalse;
13 public ConditionalExpression(final Expression condition,
14 final Expression valueIfTrue,
15 final Expression valueIfFalse) {
16 super(-1, condition.sourceStart, valueIfFalse.sourceEnd);
17 this.condition = condition;
18 this.valueIfTrue = valueIfTrue;
19 this.valueIfFalse = valueIfFalse;
22 public String toStringExpression() {
23 final StringBuffer buff = new StringBuffer("(");
24 buff.append(condition.toStringExpression());
26 buff.append(valueIfTrue.toStringExpression());
28 buff.append(valueIfFalse.toStringExpression());
29 return buff.toString();
33 * Get the variables from outside (parameters, globals ...)
35 public void getOutsideVariable(final List list) {
39 * get the modified variables.
41 public void getModifiedVariable(final List list) {
42 condition.getModifiedVariable(list);
43 valueIfTrue.getModifiedVariable(list);
44 valueIfFalse.getModifiedVariable(list);
48 * Get the variables used.
50 public void getUsedVariable(final List list) {
51 condition.getUsedVariable(list);
52 valueIfTrue.getUsedVariable(list);
53 valueIfFalse.getUsedVariable(list);