1 /*
2 * ASAssignmentExpression.java
3 *
4 * Copyright (c) 2008 David Holroyd
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package uk.co.badgersinfoil.metaas.dom;
20
21 import uk.co.badgersinfoil.metaas.ActionScriptFactory;
22
23 /**
24 * An assignment expression, such as <code>a = b</code> or <code>a += b</code>.
25 *
26 * @see ActionScriptFactory#newAssignExpression(Expression, Expression)
27 * @see ActionScriptFactory#newAddAssignExpression(Expression, Expression)
28 * @see ActionScriptFactory#newBitAndAssignExpression(Expression, Expression)
29 * @see ActionScriptFactory#newBitOrAssignExpression(Expression, Expression)
30 * @see ActionScriptFactory#newBitXorAssignExpression(Expression, Expression)
31 * @see ActionScriptFactory#newDivideAssignExpression(Expression, Expression)
32 * @see ActionScriptFactory#newModuloAssignExpression(Expression, Expression)
33 * @see ActionScriptFactory#newMultiplyAssignExpression(Expression, Expression)
34 * @see ActionScriptFactory#newShiftLeftAssignExpression(Expression, Expression)
35 * @see ActionScriptFactory#newShiftRightAssignExpression(Expression, Expression)
36 * @see ActionScriptFactory#newShiftRightUnsignedAssignExpression(Expression, Expression)
37 * @see ActionScriptFactory#newSubtractAssignExpression(Expression, Expression)
38 */
39 public interface ASAssignmentExpression extends Expression {
40 public Op getOperator();
41 public void setOperator(Op operator);
42 public Expression getLeftSubexpression();
43 public void setLeftSubexpression(Expression left);
44 public Expression getRightSubexpression();
45 public void setRightSubexpression(Expression right);
46
47 /**
48 * Operators allowed for assignment-expressions
49 */
50 public static class Op {
51 private String name;
52 private Op(String name) {
53 this.name = name;
54 }
55
56 /** '+=' */
57 public static final Op ADD_ASSIGN = new Op("ADD_ASSIGN");
58 /** Assignment '=' */
59 public static final Op ASSIGN = new Op("ASSIGN");
60 /** '&=' */
61 public static final Op BITAND_ASSIGN = new Op("BITAND_ASSIGN");
62 /** '|=' */
63 public static final Op BITOR_ASSIGN = new Op("BITOR_ASSIGN");
64 /** '^=' */
65 public static final Op BITXOR_ASSIGN = new Op("BITXOR_ASSIGN");
66 /** '/=' */
67 public static final Op DIV_ASSIGN = new Op("DIV_ASSIGN");
68 /** '%=' */
69 public static final Op MOD_ASSIGN = new Op("MOD_ASSIGN");
70 /** '*=' */
71 public static final Op MUL_ASSIGN = new Op("MUL_ASSIGN");
72 /** Left Shift Assigment '<<=' */
73 public static final Op SL_ASSIGN = new Op("SL_ASSIGN");
74 /** Right Shift Assigment '>>=' */
75 public static final Op SR_ASSIGN = new Op("SR_ASSIGN");
76 /** Unsigned Right Shift Assigment '>>>=' */
77 public static final Op SRU_ASSIGN = new Op("SRU_ASSIGN");
78 /** '-=' */
79 public static final Op SUB_ASSIGN = new Op("SUB_ASSIGN");
80
81 public String toString() {
82 return name;
83 }
84 }
85 }