1 package net.sourceforge.phpdt.internal.compiler.ast;
4 * Any expression that have an operator.
5 * @author Matthieu Casanova
7 public abstract class OperatorExpression
9 implements OperatorIds {
13 public OperatorExpression(int operator, int sourceStart, int sourceEnd) {
14 super(sourceStart, sourceEnd);
15 this.operator = operator;
18 public String operatorToString() {
21 return "=="; //$NON-NLS-1$
23 return "<="; //$NON-NLS-1$
25 return ">="; //$NON-NLS-1$
27 return "!="; //$NON-NLS-1$
29 return "<<"; //$NON-NLS-1$
31 return ">>"; //$NON-NLS-1$
32 case UNSIGNED_RIGHT_SHIFT :
33 return ">>>"; //$NON-NLS-1$
35 return "||"; //$NON-NLS-1$
37 return "&&"; //$NON-NLS-1$
39 return "+"; //$NON-NLS-1$
41 return "-"; //$NON-NLS-1$
43 return "!"; //$NON-NLS-1$
45 return "%"; //$NON-NLS-1$
47 return "^"; //$NON-NLS-1$
49 return "&"; //$NON-NLS-1$
51 return "*"; //$NON-NLS-1$
53 return "|"; //$NON-NLS-1$
55 return "~"; //$NON-NLS-1$
57 return "/"; //$NON-NLS-1$
59 return ">"; //$NON-NLS-1$
61 return "<"; //$NON-NLS-1$
63 return "OR"; //$NON-NLS-1$
65 return "AND"; //$NON-NLS-1$
67 return "."; //$NON-NLS-1$
69 return "<>"; //$NON-NLS-1$
70 case BANG_EQUAL_EQUAL :
71 return "!=="; //$NON-NLS-1$
72 case EQUAL_EQUAL_EQUAL :
73 return "==="; //$NON-NLS-1$
75 return "@"; //$NON-NLS-1$
77 return "unknown operator"; //$NON-NLS-1$
80 public String toStringExpression(){
81 //subclass redefine toStringExpressionNoParenthesis()
82 return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
85 public abstract String toStringExpressionNoParenthesis();