1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * a binary expression is a combination of two expressions with an operator.
8 * @author Matthieu Casanova
10 public final class BinaryExpression extends OperatorExpression {
12 /** The left expression. */
13 private final Expression left;
14 /** The right expression. */
15 private final Expression right;
18 * Create a binary expression.
20 * @param left the left expression
21 * @param right the right expression
22 * @param operator an operator taken in the {@link OperatorExpression} interface
24 public BinaryExpression(final Expression left,
25 final Expression right,
27 super(operator, left.sourceStart, right.sourceEnd);
32 public String toStringExpression() {
33 final String leftString = left.toStringExpression();
34 final String operatorString = operatorToString();
35 final String rightString = right.toStringExpression();
36 final StringBuffer buff = new StringBuffer(leftString.length() + operatorString.length() + rightString.length());
37 buff.append(leftString);
38 buff.append(operatorString);
39 buff.append(rightString);
40 return buff.toString();
44 * Get the variables from outside (parameters, globals ...)
46 * @param list the list where we will put variables
48 public void getOutsideVariable(final List list) {}
51 * get the modified variables.
53 * @param list the list where we will put variables
55 public void getModifiedVariable(final List list) {
56 left.getModifiedVariable(list);
57 right.getModifiedVariable(list);
61 * Get the variables used.
63 * @param list the list where we will put variables
65 public void getUsedVariable(final List list) {
66 left.getUsedVariable(list);
67 right.getUsedVariable(list);