1 package net.sourceforge.jenesis4java;
2
3 /*
4 * #%L
5 * Jenesis 4 Java Code Generator
6 * %%
7 * Copyright (C) 2000 - 2015 jenesis4java
8 * %%
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Lesser Public License for more details.
18 *
19 * You should have received a copy of the GNU General Lesser Public
20 * License along with this program. If not, see
21 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22 * #L%
23 */
24
25 /**
26 * Copyright (C) 2008, 2010 Richard van Nieuwenhoven - ritchie [at] gmx [dot] at
27 * Copyright (C) 2000, 2001 Paul Cody Johnston - pcj@inxar.org <br>
28 * This file is part of Jenesis4java. Jenesis4java is free software: you can
29 * redistribute it and/or modify it under the terms of the GNU Lesser General
30 * Public License as published by the Free Software Foundation, either version 3
31 * of the License, or (at your option) any later version.<br>
32 * Jenesis4java is distributed in the hope that it will be useful, but WITHOUT
33 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
35 * details.<br>
36 * You should have received a copy of the GNU Lesser General Public License
37 * along with Jenesis4java. If not, see <http://www.gnu.org/licenses/>.
38 */
39
40 /**
41 * {@code Expression} subinterface for expressions which have left and right
42 * operands.
43 */
44 public interface Binary extends Expression {
45
46 /**
47 * Binary function type for logical and: {@code (a && b)}.
48 */
49 int AND = 1;
50
51 /**
52 * Binary function type for logical and: {@code (a && b)}.
53 *
54 * @deprecated use {@link @AND} instead.
55 */
56 @Deprecated
57 int LAND = AND;
58
59 /**
60 * Binary function type for logical or: {@code (a || b)}.
61 */
62 int OR = 2;
63
64 /**
65 * Binary function type for logical or: {@code (a || b)}.
66 *
67 * @deprecated use {@link #OR} instead
68 */
69 @Deprecated
70 int LOR = OR;
71
72 /**
73 * Binary function type for bitwise and: {@code (a & b)}.
74 */
75 int BINARY_AND = 3;
76
77 /**
78 * Binary function type for bitwise and: {@code (a & b)}.
79 *
80 * @deprecated use {@link #BINARY_AND} instead
81 */
82 @Deprecated
83 int BAND = BINARY_AND;
84
85 /**
86 * Binary function type for bitwise or: {@code (a | b)}.
87 */
88 int BINARY_OR = 4;
89
90 /**
91 * Binary function type for bitwise or: {@code (a | b)}.
92 *
93 * @deprecated use {@link #BINARY_OR} instead
94 */
95 @Deprecated
96 int BOR = BINARY_OR;
97
98 /**
99 * Binary function type for bitwise xor: {@code (a ^ b)}.
100 */
101 int XOR = 5;
102
103 /**
104 * Binary function type for bitwise left shift: {@code (a << b)}.
105 */
106 int LEFT = 6;
107
108 /**
109 * Binary function type for bitwise right shift: {@code (a >> b)}.
110 */
111 int RIGHT = 7;
112
113 /**
114 * Binary function type for bitwise unsigned right shift: {@code (a >>> b)}.
115 */
116 int UNSIGNED = 8;
117
118 /**
119 * Binary function type for arithmetic addition: {@code (a +
120 * b)}.
121 */
122 int ADD = 9;
123
124 /**
125 * Binary function type for arithmetix subtraction: {@code (a -
126 * b)}.
127 */
128 int SUB = 10;
129
130 /**
131 * Binary function type for arithmetic multiplication: {@code (a *
132 * b)}.
133 */
134 int MUL = 11;
135
136 /**
137 * Binary function type for arithmetic division: {@code (a /
138 * b)}.
139 */
140 int DIV = 12;
141
142 /**
143 * Binary function type for arithmetic modulus: {@code (a %
144 * b)}.
145 */
146 int MOD = 13;
147
148 /**
149 * Binary function type for predicate equals: {@code (a ==
150 * b)}.
151 */
152 int EQUAL_TO = 14;
153
154 /**
155 * Binary function type for predicate equals: {@code (a ==
156 * b)}.
157 *
158 * @deprecated use {@link #EQUAL_TO} instead
159 */
160 @Deprecated
161 int EQ = EQUAL_TO;
162
163 /**
164 * Binary function type for predicate not equals: {@code (a != b)}.
165 */
166 int NOT_EQUAL = 15;
167
168 /**
169 * Binary function type for predicate not equals: {@code (a != b)}.
170 *
171 * @deprecated use {@link #NOT_EQUAL} instead
172 */
173 @Deprecated
174 int NE = NOT_EQUAL;
175
176 /**
177 * Binary function type for predicate greater than: {@code (a > b)}.
178 */
179 int GREATER = 16;
180
181 /**
182 * Binary function type for predicate greater than: {@code (a > b)}.
183 *
184 * @deprecated use {@link #GREATER} instead
185 */
186 @Deprecated
187 int GT = GREATER;
188
189 /**
190 * Binary function type for compund predicate greater than or equal:
191 * {@code (a => b)}.
192 */
193 int GREATER_EQUAL = 17;
194
195 /**
196 * Binary function type for compund predicate greater than or equal:
197 * {@code (a => b)}.
198 *
199 * @deprecated use {@link #GREATER_EQUAL} instead.
200 */
201 @Deprecated
202 int GTE = GREATER_EQUAL;
203
204 /**
205 * Binary function type for predicate less than: {@code (a < b)}.
206 */
207 int LESS = 18;
208
209 /**
210 * Binary function type for predicate less than: {@code (a < b)}.
211 *
212 * @deprecated use {@link #LESS} instead
213 */
214 @Deprecated
215 int LT = LESS;
216
217 /**
218 * Binary function type for compound predicate less than or equal:
219 * {@code (a <= b)}.
220 */
221 int LESS_EQUAL = 19;
222
223 /**
224 * Binary function type for compound predicate less than or equal:
225 * {@code (a <= b)}.
226 *
227 * @deprecated use {@link #LESS_EQUAL} instead
228 */
229 @Deprecated
230 int LTE = LESS_EQUAL;
231
232 /**
233 * Binary function type for class equality operator:
234 * {@code (a instanceof b)}.
235 */
236 int INSTANCE_OF = 20;
237
238 /**
239 * Binary function type for class equality: {@code (a instanceof
240 * b)}.
241 *
242 * @deprecated use {@link #INSTANCE_OF} instead
243 */
244 @Deprecated
245 int IOF = INSTANCE_OF;
246
247 /**
248 * Binary function type for string concatenation: {@code (a + b)}.
249 */
250 int CAT = 21;
251
252 /**
253 * Binary function type for assignment: {@code (a = b)}.
254 */
255 int ASSIGN = 22;
256
257 /**
258 * Getter method for the left side.
259 */
260 Expression getLValue();
261
262 /**
263 * Getter method for the right side.
264 */
265 Expression getRValue();
266
267 /**
268 * Setter method for the left side.
269 */
270 Binary setLValue(Expression e);
271
272 /**
273 * Setter method for the right side.
274 */
275 Binary setRValue(Expression e);
276
277 /**
278 * Returns the type of this binary function as one of the constants in this
279 * interface.
280 */
281 int type();
282 }