KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > TIR > Impl > ExprHelp


1 /* $Id: ExprHelp.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.TIR.Impl;
3 import java.rmi.RemoteException;
4
5 import SOFA.SOFAnode.Made.TIR.ExprBinOperationDef;
6 import SOFA.SOFAnode.Made.TIR.ExprBoolean;
7 import SOFA.SOFAnode.Made.TIR.ExprChar;
8 import SOFA.SOFAnode.Made.TIR.ExprConstant;
9 import SOFA.SOFAnode.Made.TIR.ExprDouble;
10 import SOFA.SOFAnode.Made.TIR.ExprEnum;
11 import SOFA.SOFAnode.Made.TIR.ExprFixed;
12 import SOFA.SOFAnode.Made.TIR.ExprFloat;
13 import SOFA.SOFAnode.Made.TIR.ExprLong;
14 import SOFA.SOFAnode.Made.TIR.ExprLongLong;
15 import SOFA.SOFAnode.Made.TIR.ExprOctet;
16 import SOFA.SOFAnode.Made.TIR.ExprOperDef;
17 import SOFA.SOFAnode.Made.TIR.ExprOperKind;
18 import SOFA.SOFAnode.Made.TIR.ExprProperty;
19 import SOFA.SOFAnode.Made.TIR.ExprShort;
20 import SOFA.SOFAnode.Made.TIR.ExprString;
21 import SOFA.SOFAnode.Made.TIR.ExprUnOperationDef;
22 import SOFA.SOFAnode.Made.TIR.ExprUnsigLong;
23 import SOFA.SOFAnode.Made.TIR.ExprUnsigLongLong;
24 import SOFA.SOFAnode.Made.TIR.ExprUnsigShort;
25 import SOFA.SOFAnode.Made.TIR.ExprWchar;
26 import SOFA.SOFAnode.Made.TIR.ExprWstring;
27 import SOFA.SOFAnode.Made.TIR.StateKind;
28 import SOFA.SOFAnode.Made.TIR.TIRExceptCalculate;
29 import SOFA.SOFAnode.Made.TIR.ValueGen;
30 import SOFA.SOFAnode.Made.TIR.ValueGenElement;
31
32 /** some useful functions for calculate expressions */
33 public class ExprHelp {
34   private static int max(int a, int b) {
35     return (a<b)?b:a;
36   }
37
38   public static ExprOperDef plus(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
39     switch (a.get_eok_kind().value()) {
40     case ExprOperKind.eok_short:
41       switch (b.get_eok_kind().value()) {
42       case ExprOperKind.eok_short:
43         return new ExprShortImpl((short)(((ExprShort)a).value()+((ExprShort)b).value()));
44       case ExprOperKind.eok_long:
45         return new ExprLongImpl((((ExprShort)a).value()+((ExprLong)b).value()));
46       case ExprOperKind.eok_longlong:
47         return new ExprLongLongImpl((((ExprShort)a).value()+((ExprLongLong)b).value()));
48       case ExprOperKind.eok_unsigshort:
49         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()+((ExprUnsigShort)b).value())));
50       case ExprOperKind.eok_unsiglong:
51         return new ExprUnsigLongImpl((((ExprShort)a).value()+((ExprUnsigLong)b).value()));
52       case ExprOperKind.eok_unsiglonglong:
53         return new ExprUnsigLongLongImpl((((ExprShort)a).value()+((ExprUnsigLongLong)b).value()));
54       case ExprOperKind.eok_octet:
55         return new ExprShortImpl((short)((((ExprShort)a).value()+((ExprOctet)b).value())));
56       default: throw new TIRExceptCalculate("Can't calculate.");
57       }
58
59     case ExprOperKind.eok_long:
60       switch (b.get_eok_kind().value()) {
61       case ExprOperKind.eok_short:
62         return new ExprLongImpl((((ExprLong)a).value()+((ExprShort)b).value()));
63       case ExprOperKind.eok_long:
64         return new ExprLongImpl((((ExprLong)a).value()+((ExprLong)b).value()));
65       case ExprOperKind.eok_longlong:
66         return new ExprLongLongImpl((((ExprLong)a).value()+((ExprLongLong)b).value()));
67       case ExprOperKind.eok_unsigshort:
68         return new ExprLongImpl(((((ExprLong)a).value()+((ExprUnsigShort)b).value())));
69       case ExprOperKind.eok_unsiglong:
70         return new ExprUnsigLongImpl((((ExprLong)a).value()+((ExprUnsigLong)b).value()));
71       case ExprOperKind.eok_unsiglonglong:
72         return new ExprUnsigLongLongImpl((((ExprLong)a).value()+((ExprUnsigLongLong)b).value()));
73       case ExprOperKind.eok_octet:
74         return new ExprLongImpl((((ExprLong)a).value()+((ExprOctet)b).value()));
75       default: throw new TIRExceptCalculate("Can't calculate.");
76       }
77
78     case ExprOperKind.eok_longlong:
79       switch (b.get_eok_kind().value()) {
80       case ExprOperKind.eok_short:
81         return new ExprLongLongImpl((((ExprLongLong)a).value()+((ExprShort)b).value()));
82       case ExprOperKind.eok_long:
83         return new ExprLongLongImpl((((ExprLongLong)a).value()+((ExprLong)b).value()));
84       case ExprOperKind.eok_longlong:
85         return new ExprLongLongImpl((((ExprLongLong)a).value()+((ExprLongLong)b).value()));
86       case ExprOperKind.eok_unsigshort:
87         return new ExprLongLongImpl(((((ExprLongLong)a).value()+((ExprUnsigShort)b).value())));
88       case ExprOperKind.eok_unsiglong:
89         return new ExprLongLongImpl((((ExprLongLong)a).value()+((ExprUnsigLong)b).value()));
90       case ExprOperKind.eok_unsiglonglong:
91         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()+((ExprUnsigLongLong)b).value()));
92       case ExprOperKind.eok_octet:
93         return new ExprLongLongImpl((((ExprLongLong)a).value()+((ExprOctet)b).value()));
94       default: throw new TIRExceptCalculate("Can't calculate.");
95       }
96
97     case ExprOperKind.eok_unsigshort:
98       switch (b.get_eok_kind().value()) {
99       case ExprOperKind.eok_short:
100         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()+((ExprShort)b).value()));
101       case ExprOperKind.eok_long:
102         return new ExprLongImpl((((ExprUnsigShort)a).value()+((ExprLong)b).value()));
103       case ExprOperKind.eok_longlong:
104         return new ExprLongLongImpl((((ExprUnsigShort)a).value()+((ExprLongLong)b).value()));
105       case ExprOperKind.eok_unsigshort:
106         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()+((ExprUnsigShort)b).value())));
107       case ExprOperKind.eok_unsiglong:
108         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()+((ExprUnsigLong)b).value()));
109       case ExprOperKind.eok_unsiglonglong:
110         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()+((ExprUnsigLongLong)b).value()));
111       case ExprOperKind.eok_octet:
112         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()+((ExprOctet)b).value())));
113       default: throw new TIRExceptCalculate("Can't calculate.");
114       }
115
116     case ExprOperKind.eok_unsiglong:
117       switch (b.get_eok_kind().value()) {
118       case ExprOperKind.eok_short:
119         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()+((ExprShort)b).value()));
120       case ExprOperKind.eok_long:
121         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()+((ExprLong)b).value()));
122       case ExprOperKind.eok_longlong:
123         return new ExprLongLongImpl((((ExprUnsigLong)a).value()+((ExprLongLong)b).value()));
124       case ExprOperKind.eok_unsigshort:
125         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()+((ExprUnsigShort)b).value())));
126       case ExprOperKind.eok_unsiglong:
127         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()+((ExprUnsigLong)b).value()));
128       case ExprOperKind.eok_unsiglonglong:
129         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()+((ExprUnsigLongLong)b).value()));
130       case ExprOperKind.eok_octet:
131         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()+((ExprOctet)b).value()));
132       default: throw new TIRExceptCalculate("Can't calculate.");
133       }
134
135     case ExprOperKind.eok_unsiglonglong:
136       switch (b.get_eok_kind().value()) {
137       case ExprOperKind.eok_short:
138         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprShort)b).value()));
139       case ExprOperKind.eok_long:
140         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprLong)b).value()));
141       case ExprOperKind.eok_longlong:
142         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprLongLong)b).value()));
143       case ExprOperKind.eok_unsigshort:
144         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()+((ExprUnsigShort)b).value())));
145       case ExprOperKind.eok_unsiglong:
146         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprUnsigLong)b).value()));
147       case ExprOperKind.eok_unsiglonglong:
148         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprUnsigLongLong)b).value()));
149       case ExprOperKind.eok_octet:
150         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()+((ExprOctet)b).value()));
151       default: throw new TIRExceptCalculate("Can't calculate.");
152       }
153
154     case ExprOperKind.eok_octet:
155       switch (b.get_eok_kind().value()) {
156       case ExprOperKind.eok_short:
157         return new ExprShortImpl((short)(((ExprOctet)a).value()+((ExprShort)b).value()));
158       case ExprOperKind.eok_long:
159         return new ExprLongImpl((((ExprOctet)a).value()+((ExprLong)b).value()));
160       case ExprOperKind.eok_longlong:
161         return new ExprLongLongImpl((((ExprOctet)a).value()+((ExprLongLong)b).value()));
162       case ExprOperKind.eok_unsigshort:
163         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()+((ExprUnsigShort)b).value())));
164       case ExprOperKind.eok_unsiglong:
165         return new ExprUnsigLongImpl((((ExprOctet)a).value()+((ExprUnsigLong)b).value()));
166       case ExprOperKind.eok_unsiglonglong:
167         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()+((ExprUnsigLongLong)b).value()));
168       case ExprOperKind.eok_octet:
169         return new ExprOctetImpl((byte)((((ExprOctet)a).value()+((ExprOctet)b).value())));
170       default: throw new TIRExceptCalculate("Can't calculate.");
171       }
172
173     case ExprOperKind.eok_float:
174       switch (b.get_eok_kind().value()) {
175       case ExprOperKind.eok_float:
176         return new ExprFloatImpl(((ExprFloat)a).value()+((ExprFloat)b).value());
177       case ExprOperKind.eok_double:
178         return new ExprDoubleImpl(((ExprFloat)a).value()+((ExprDouble)b).value());
179       default: throw new TIRExceptCalculate("Can't calculate.");
180       }
181
182     case ExprOperKind.eok_double:
183       switch (b.get_eok_kind().value()) {
184       case ExprOperKind.eok_float:
185         return new ExprDoubleImpl(((ExprDouble)a).value()+((ExprFloat)b).value());
186       case ExprOperKind.eok_double:
187         return new ExprDoubleImpl(((ExprDouble)a).value()+((ExprDouble)b).value());
188       default: throw new TIRExceptCalculate("Can't calculate.");
189       }
190
191     case ExprOperKind.eok_fixed:
192       switch (b.get_eok_kind().value()) {
193       case ExprOperKind.eok_fixed:
194         int d1 = ((ExprFixed)a).digits();
195         int s1 = ((ExprFixed)a).scale();
196         int d2 = ((ExprFixed)b).digits();
197         int s2 = ((ExprFixed)b).scale();
198         int d = max(d1-s1,d2-s2)+max(s1,s2)+1;
199         int s = max(s1,s2);
200         if (d>31) {
201           d = 31; s = 31-d+s;
202         }
203         return new ExprFixedImpl(((ExprFixed)a).value().add(((ExprFixed)b).value()),d,s);
204       default: throw new TIRExceptCalculate("Can't calculate.");
205       }
206     default: throw new TIRExceptCalculate("Can't calculate.");
207     }
208   }
209
210   public static ExprOperDef minus(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
211     switch (a.get_eok_kind().value()) {
212     case ExprOperKind.eok_short:
213       switch (b.get_eok_kind().value()) {
214       case ExprOperKind.eok_short:
215         return new ExprShortImpl((short)(((ExprShort)a).value()-((ExprShort)b).value()));
216       case ExprOperKind.eok_long:
217         return new ExprLongImpl((((ExprShort)a).value()-((ExprLong)b).value()));
218       case ExprOperKind.eok_longlong:
219         return new ExprLongLongImpl((((ExprShort)a).value()-((ExprLongLong)b).value()));
220       case ExprOperKind.eok_unsigshort:
221         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()-((ExprUnsigShort)b).value())));
222       case ExprOperKind.eok_unsiglong:
223         return new ExprUnsigLongImpl((((ExprShort)a).value()-((ExprUnsigLong)b).value()));
224       case ExprOperKind.eok_unsiglonglong:
225         return new ExprUnsigLongLongImpl((((ExprShort)a).value()-((ExprUnsigLongLong)b).value()));
226       case ExprOperKind.eok_octet:
227         return new ExprShortImpl((short)((((ExprShort)a).value()-((ExprOctet)b).value())));
228       default: throw new TIRExceptCalculate("Can't calculate.");
229       }
230
231     case ExprOperKind.eok_long:
232       switch (b.get_eok_kind().value()) {
233       case ExprOperKind.eok_short:
234         return new ExprLongImpl((((ExprLong)a).value()-((ExprShort)b).value()));
235       case ExprOperKind.eok_long:
236         return new ExprLongImpl((((ExprLong)a).value()-((ExprLong)b).value()));
237       case ExprOperKind.eok_longlong:
238         return new ExprLongLongImpl((((ExprLong)a).value()-((ExprLongLong)b).value()));
239       case ExprOperKind.eok_unsigshort:
240         return new ExprLongImpl(((((ExprLong)a).value()-((ExprUnsigShort)b).value())));
241       case ExprOperKind.eok_unsiglong:
242         return new ExprUnsigLongImpl((((ExprLong)a).value()-((ExprUnsigLong)b).value()));
243       case ExprOperKind.eok_unsiglonglong:
244         return new ExprUnsigLongLongImpl((((ExprLong)a).value()-((ExprUnsigLongLong)b).value()));
245       case ExprOperKind.eok_octet:
246         return new ExprLongImpl((((ExprLong)a).value()-((ExprOctet)b).value()));
247       default: throw new TIRExceptCalculate("Can't calculate.");
248       }
249
250     case ExprOperKind.eok_longlong:
251       switch (b.get_eok_kind().value()) {
252       case ExprOperKind.eok_short:
253         return new ExprLongLongImpl((((ExprLongLong)a).value()-((ExprShort)b).value()));
254       case ExprOperKind.eok_long:
255         return new ExprLongLongImpl((((ExprLongLong)a).value()-((ExprLong)b).value()));
256       case ExprOperKind.eok_longlong:
257         return new ExprLongLongImpl((((ExprLongLong)a).value()-((ExprLongLong)b).value()));
258       case ExprOperKind.eok_unsigshort:
259         return new ExprLongLongImpl(((((ExprLongLong)a).value()-((ExprUnsigShort)b).value())));
260       case ExprOperKind.eok_unsiglong:
261         return new ExprLongLongImpl((((ExprLongLong)a).value()-((ExprUnsigLong)b).value()));
262       case ExprOperKind.eok_unsiglonglong:
263         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()-((ExprUnsigLongLong)b).value()));
264       case ExprOperKind.eok_octet:
265         return new ExprLongLongImpl((((ExprLongLong)a).value()-((ExprOctet)b).value()));
266       default: throw new TIRExceptCalculate("Can't calculate.");
267       }
268
269     case ExprOperKind.eok_unsigshort:
270       switch (b.get_eok_kind().value()) {
271       case ExprOperKind.eok_short:
272         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()-((ExprShort)b).value()));
273       case ExprOperKind.eok_long:
274         return new ExprLongImpl((((ExprUnsigShort)a).value()-((ExprLong)b).value()));
275       case ExprOperKind.eok_longlong:
276         return new ExprLongLongImpl((((ExprUnsigShort)a).value()-((ExprLongLong)b).value()));
277       case ExprOperKind.eok_unsigshort:
278         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()-((ExprUnsigShort)b).value())));
279       case ExprOperKind.eok_unsiglong:
280         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()-((ExprUnsigLong)b).value()));
281       case ExprOperKind.eok_unsiglonglong:
282         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()-((ExprUnsigLongLong)b).value()));
283       case ExprOperKind.eok_octet:
284         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()-((ExprOctet)b).value())));
285       default: throw new TIRExceptCalculate("Can't calculate.");
286       }
287
288     case ExprOperKind.eok_unsiglong:
289       switch (b.get_eok_kind().value()) {
290       case ExprOperKind.eok_short:
291         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()-((ExprShort)b).value()));
292       case ExprOperKind.eok_long:
293         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()-((ExprLong)b).value()));
294       case ExprOperKind.eok_longlong:
295         return new ExprLongLongImpl((((ExprUnsigLong)a).value()-((ExprLongLong)b).value()));
296       case ExprOperKind.eok_unsigshort:
297         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()-((ExprUnsigShort)b).value())));
298       case ExprOperKind.eok_unsiglong:
299         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()-((ExprUnsigLong)b).value()));
300       case ExprOperKind.eok_unsiglonglong:
301         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()-((ExprUnsigLongLong)b).value()));
302       case ExprOperKind.eok_octet:
303         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()-((ExprOctet)b).value()));
304       default: throw new TIRExceptCalculate("Can't calculate.");
305       }
306
307     case ExprOperKind.eok_unsiglonglong:
308       switch (b.get_eok_kind().value()) {
309       case ExprOperKind.eok_short:
310         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprShort)b).value()));
311       case ExprOperKind.eok_long:
312         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprLong)b).value()));
313       case ExprOperKind.eok_longlong:
314         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprLongLong)b).value()));
315       case ExprOperKind.eok_unsigshort:
316         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()-((ExprUnsigShort)b).value())));
317       case ExprOperKind.eok_unsiglong:
318         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprUnsigLong)b).value()));
319       case ExprOperKind.eok_unsiglonglong:
320         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprUnsigLongLong)b).value()));
321       case ExprOperKind.eok_octet:
322         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()-((ExprOctet)b).value()));
323       default: throw new TIRExceptCalculate("Can't calculate.");
324       }
325
326     case ExprOperKind.eok_octet:
327       switch (b.get_eok_kind().value()) {
328       case ExprOperKind.eok_short:
329         return new ExprShortImpl((short)(((ExprOctet)a).value()-((ExprShort)b).value()));
330       case ExprOperKind.eok_long:
331         return new ExprLongImpl((((ExprOctet)a).value()-((ExprLong)b).value()));
332       case ExprOperKind.eok_longlong:
333         return new ExprLongLongImpl((((ExprOctet)a).value()-((ExprLongLong)b).value()));
334       case ExprOperKind.eok_unsigshort:
335         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()-((ExprUnsigShort)b).value())));
336       case ExprOperKind.eok_unsiglong:
337         return new ExprUnsigLongImpl((((ExprOctet)a).value()-((ExprUnsigLong)b).value()));
338       case ExprOperKind.eok_unsiglonglong:
339         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()-((ExprUnsigLongLong)b).value()));
340       case ExprOperKind.eok_octet:
341         return new ExprOctetImpl((byte)((((ExprOctet)a).value()-((ExprOctet)b).value())));
342       default: throw new TIRExceptCalculate("Can't calculate.");
343       }
344
345     case ExprOperKind.eok_float:
346       switch (b.get_eok_kind().value()) {
347       case ExprOperKind.eok_float:
348         return new ExprFloatImpl(((ExprFloat)a).value()-((ExprFloat)b).value());
349       case ExprOperKind.eok_double:
350         return new ExprDoubleImpl(((ExprFloat)a).value()-((ExprDouble)b).value());
351       default: throw new TIRExceptCalculate("Can't calculate.");
352       }
353
354     case ExprOperKind.eok_double:
355       switch (b.get_eok_kind().value()) {
356       case ExprOperKind.eok_float:
357         return new ExprDoubleImpl(((ExprDouble)a).value()-((ExprFloat)b).value());
358       case ExprOperKind.eok_double:
359         return new ExprDoubleImpl(((ExprDouble)a).value()-((ExprDouble)b).value());
360       default: throw new TIRExceptCalculate("Can't calculate.");
361       }
362
363     case ExprOperKind.eok_fixed:
364       switch (b.get_eok_kind().value()) {
365       case ExprOperKind.eok_fixed:
366         int d1 = ((ExprFixed)a).digits();
367         int s1 = ((ExprFixed)a).scale();
368         int d2 = ((ExprFixed)b).digits();
369         int s2 = ((ExprFixed)b).scale();
370         int d = max(d1-s1,d2-s2)+max(s1,s2)+1;
371         int s = max(s1,s2);
372         if (d>31) {
373           d = 31; s = 31-d+s;
374         }
375         return new ExprFixedImpl(((ExprFixed)a).value().subtract(((ExprFixed)b).value()),d,s);
376       default: throw new TIRExceptCalculate("Can't calculate.");
377       }
378     default: throw new TIRExceptCalculate("Can't calculate.");
379     }
380   }
381
382   public static ExprOperDef mul(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
383     switch (a.get_eok_kind().value()) {
384     case ExprOperKind.eok_short:
385       switch (b.get_eok_kind().value()) {
386       case ExprOperKind.eok_short:
387         return new ExprShortImpl((short)(((ExprShort)a).value()*((ExprShort)b).value()));
388       case ExprOperKind.eok_long:
389         return new ExprLongImpl((((ExprShort)a).value()*((ExprLong)b).value()));
390       case ExprOperKind.eok_longlong:
391         return new ExprLongLongImpl((((ExprShort)a).value()*((ExprLongLong)b).value()));
392       case ExprOperKind.eok_unsigshort:
393         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()*((ExprUnsigShort)b).value())));
394       case ExprOperKind.eok_unsiglong:
395         return new ExprUnsigLongImpl((((ExprShort)a).value()*((ExprUnsigLong)b).value()));
396       case ExprOperKind.eok_unsiglonglong:
397         return new ExprUnsigLongLongImpl((((ExprShort)a).value()*((ExprUnsigLongLong)b).value()));
398       case ExprOperKind.eok_octet:
399         return new ExprShortImpl((short)((((ExprShort)a).value()*((ExprOctet)b).value())));
400       default: throw new TIRExceptCalculate("Can't calculate.");
401       }
402
403     case ExprOperKind.eok_long:
404       switch (b.get_eok_kind().value()) {
405       case ExprOperKind.eok_short:
406         return new ExprLongImpl((((ExprLong)a).value()*((ExprShort)b).value()));
407       case ExprOperKind.eok_long:
408         return new ExprLongImpl((((ExprLong)a).value()*((ExprLong)b).value()));
409       case ExprOperKind.eok_longlong:
410         return new ExprLongLongImpl((((ExprLong)a).value()*((ExprLongLong)b).value()));
411       case ExprOperKind.eok_unsigshort:
412         return new ExprLongImpl(((((ExprLong)a).value()*((ExprUnsigShort)b).value())));
413       case ExprOperKind.eok_unsiglong:
414         return new ExprUnsigLongImpl((((ExprLong)a).value()*((ExprUnsigLong)b).value()));
415       case ExprOperKind.eok_unsiglonglong:
416         return new ExprUnsigLongLongImpl((((ExprLong)a).value()*((ExprUnsigLongLong)b).value()));
417       case ExprOperKind.eok_octet:
418         return new ExprLongImpl((((ExprLong)a).value()*((ExprOctet)b).value()));
419       default: throw new TIRExceptCalculate("Can't calculate.");
420       }
421
422     case ExprOperKind.eok_longlong:
423       switch (b.get_eok_kind().value()) {
424       case ExprOperKind.eok_short:
425         return new ExprLongLongImpl((((ExprLongLong)a).value()*((ExprShort)b).value()));
426       case ExprOperKind.eok_long:
427         return new ExprLongLongImpl((((ExprLongLong)a).value()*((ExprLong)b).value()));
428       case ExprOperKind.eok_longlong:
429         return new ExprLongLongImpl((((ExprLongLong)a).value()*((ExprLongLong)b).value()));
430       case ExprOperKind.eok_unsigshort:
431         return new ExprLongLongImpl(((((ExprLongLong)a).value()*((ExprUnsigShort)b).value())));
432       case ExprOperKind.eok_unsiglong:
433         return new ExprLongLongImpl((((ExprLongLong)a).value()*((ExprUnsigLong)b).value()));
434       case ExprOperKind.eok_unsiglonglong:
435         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()*((ExprUnsigLongLong)b).value()));
436       case ExprOperKind.eok_octet:
437         return new ExprLongLongImpl((((ExprLongLong)a).value()*((ExprOctet)b).value()));
438       default: throw new TIRExceptCalculate("Can't calculate.");
439       }
440
441     case ExprOperKind.eok_unsigshort:
442       switch (b.get_eok_kind().value()) {
443       case ExprOperKind.eok_short:
444         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()*((ExprShort)b).value()));
445       case ExprOperKind.eok_long:
446         return new ExprLongImpl((((ExprUnsigShort)a).value()*((ExprLong)b).value()));
447       case ExprOperKind.eok_longlong:
448         return new ExprLongLongImpl((((ExprUnsigShort)a).value()*((ExprLongLong)b).value()));
449       case ExprOperKind.eok_unsigshort:
450         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()*((ExprUnsigShort)b).value())));
451       case ExprOperKind.eok_unsiglong:
452         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()*((ExprUnsigLong)b).value()));
453       case ExprOperKind.eok_unsiglonglong:
454         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()*((ExprUnsigLongLong)b).value()));
455       case ExprOperKind.eok_octet:
456         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()*((ExprOctet)b).value())));
457       default: throw new TIRExceptCalculate("Can't calculate.");
458       }
459
460     case ExprOperKind.eok_unsiglong:
461       switch (b.get_eok_kind().value()) {
462       case ExprOperKind.eok_short:
463         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()*((ExprShort)b).value()));
464       case ExprOperKind.eok_long:
465         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()*((ExprLong)b).value()));
466       case ExprOperKind.eok_longlong:
467         return new ExprLongLongImpl((((ExprUnsigLong)a).value()*((ExprLongLong)b).value()));
468       case ExprOperKind.eok_unsigshort:
469         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()*((ExprUnsigShort)b).value())));
470       case ExprOperKind.eok_unsiglong:
471         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()*((ExprUnsigLong)b).value()));
472       case ExprOperKind.eok_unsiglonglong:
473         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()*((ExprUnsigLongLong)b).value()));
474       case ExprOperKind.eok_octet:
475         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()*((ExprOctet)b).value()));
476       default: throw new TIRExceptCalculate("Can't calculate.");
477       }
478
479     case ExprOperKind.eok_unsiglonglong:
480       switch (b.get_eok_kind().value()) {
481       case ExprOperKind.eok_short:
482         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprShort)b).value()));
483       case ExprOperKind.eok_long:
484         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprLong)b).value()));
485       case ExprOperKind.eok_longlong:
486         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprLongLong)b).value()));
487       case ExprOperKind.eok_unsigshort:
488         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()*((ExprUnsigShort)b).value())));
489       case ExprOperKind.eok_unsiglong:
490         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprUnsigLong)b).value()));
491       case ExprOperKind.eok_unsiglonglong:
492         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprUnsigLongLong)b).value()));
493       case ExprOperKind.eok_octet:
494         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()*((ExprOctet)b).value()));
495       default: throw new TIRExceptCalculate("Can't calculate.");
496       }
497
498     case ExprOperKind.eok_octet:
499       switch (b.get_eok_kind().value()) {
500       case ExprOperKind.eok_short:
501         return new ExprShortImpl((short)(((ExprOctet)a).value()*((ExprShort)b).value()));
502       case ExprOperKind.eok_long:
503         return new ExprLongImpl((((ExprOctet)a).value()*((ExprLong)b).value()));
504       case ExprOperKind.eok_longlong:
505         return new ExprLongLongImpl((((ExprOctet)a).value()*((ExprLongLong)b).value()));
506       case ExprOperKind.eok_unsigshort:
507         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()*((ExprUnsigShort)b).value())));
508       case ExprOperKind.eok_unsiglong:
509         return new ExprUnsigLongImpl((((ExprOctet)a).value()*((ExprUnsigLong)b).value()));
510       case ExprOperKind.eok_unsiglonglong:
511         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()*((ExprUnsigLongLong)b).value()));
512       case ExprOperKind.eok_octet:
513         return new ExprOctetImpl((byte)((((ExprOctet)a).value()*((ExprOctet)b).value())));
514       default: throw new TIRExceptCalculate("Can't calculate.");
515       }
516
517     case ExprOperKind.eok_float:
518       switch (b.get_eok_kind().value()) {
519       case ExprOperKind.eok_float:
520         return new ExprFloatImpl(((ExprFloat)a).value()*((ExprFloat)b).value());
521       case ExprOperKind.eok_double:
522         return new ExprDoubleImpl(((ExprFloat)a).value()*((ExprDouble)b).value());
523       default: throw new TIRExceptCalculate("Can't calculate.");
524       }
525
526     case ExprOperKind.eok_double:
527       switch (b.get_eok_kind().value()) {
528       case ExprOperKind.eok_float:
529         return new ExprDoubleImpl(((ExprDouble)a).value()*((ExprFloat)b).value());
530       case ExprOperKind.eok_double:
531         return new ExprDoubleImpl(((ExprDouble)a).value()*((ExprDouble)b).value());
532       default: throw new TIRExceptCalculate("Can't calculate.");
533       }
534
535     case ExprOperKind.eok_fixed:
536       switch (b.get_eok_kind().value()) {
537       case ExprOperKind.eok_fixed:
538         int d1 = ((ExprFixed)a).digits();
539         int s1 = ((ExprFixed)a).scale();
540         int d2 = ((ExprFixed)b).digits();
541         int s2 = ((ExprFixed)b).scale();
542         int d = d1+d2;
543         int s = s1+s2;
544         if (d>31) {
545           d = 31; s = 31-d+s;
546         }
547         return new ExprFixedImpl(((ExprFixed)a).value().multiply(((ExprFixed)b).value()),d,s);
548       default: throw new TIRExceptCalculate("Can't calculate.");
549       }
550     default: throw new TIRExceptCalculate("Can't calculate.");
551     }
552   }
553
554   public static ExprOperDef div(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
555     switch (a.get_eok_kind().value()) {
556     case ExprOperKind.eok_short:
557       switch (b.get_eok_kind().value()) {
558       case ExprOperKind.eok_short:
559         return new ExprShortImpl((short)(((ExprShort)a).value()/((ExprShort)b).value()));
560       case ExprOperKind.eok_long:
561         return new ExprLongImpl((((ExprShort)a).value()/((ExprLong)b).value()));
562       case ExprOperKind.eok_longlong:
563         return new ExprLongLongImpl((((ExprShort)a).value()/((ExprLongLong)b).value()));
564       case ExprOperKind.eok_unsigshort:
565         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()/((ExprUnsigShort)b).value())));
566       case ExprOperKind.eok_unsiglong:
567         return new ExprUnsigLongImpl((((ExprShort)a).value()/((ExprUnsigLong)b).value()));
568       case ExprOperKind.eok_unsiglonglong:
569         return new ExprUnsigLongLongImpl((((ExprShort)a).value()/((ExprUnsigLongLong)b).value()));
570       case ExprOperKind.eok_octet:
571         return new ExprShortImpl((short)((((ExprShort)a).value()/((ExprOctet)b).value())));
572       default: throw new TIRExceptCalculate("Can't calculate.");
573       }
574
575     case ExprOperKind.eok_long:
576       switch (b.get_eok_kind().value()) {
577       case ExprOperKind.eok_short:
578         return new ExprLongImpl((((ExprLong)a).value()/((ExprShort)b).value()));
579       case ExprOperKind.eok_long:
580         return new ExprLongImpl((((ExprLong)a).value()/((ExprLong)b).value()));
581       case ExprOperKind.eok_longlong:
582         return new ExprLongLongImpl((((ExprLong)a).value()/((ExprLongLong)b).value()));
583       case ExprOperKind.eok_unsigshort:
584         return new ExprLongImpl(((((ExprLong)a).value()/((ExprUnsigShort)b).value())));
585       case ExprOperKind.eok_unsiglong:
586         return new ExprUnsigLongImpl((((ExprLong)a).value()/((ExprUnsigLong)b).value()));
587       case ExprOperKind.eok_unsiglonglong:
588         return new ExprUnsigLongLongImpl((((ExprLong)a).value()/((ExprUnsigLongLong)b).value()));
589       case ExprOperKind.eok_octet:
590         return new ExprLongImpl((((ExprLong)a).value()/((ExprOctet)b).value()));
591       default: throw new TIRExceptCalculate("Can't calculate.");
592       }
593
594     case ExprOperKind.eok_longlong:
595       switch (b.get_eok_kind().value()) {
596       case ExprOperKind.eok_short:
597         return new ExprLongLongImpl((((ExprLongLong)a).value()/((ExprShort)b).value()));
598       case ExprOperKind.eok_long:
599         return new ExprLongLongImpl((((ExprLongLong)a).value()/((ExprLong)b).value()));
600       case ExprOperKind.eok_longlong:
601         return new ExprLongLongImpl((((ExprLongLong)a).value()/((ExprLongLong)b).value()));
602       case ExprOperKind.eok_unsigshort:
603         return new ExprLongLongImpl(((((ExprLongLong)a).value()/((ExprUnsigShort)b).value())));
604       case ExprOperKind.eok_unsiglong:
605         return new ExprLongLongImpl((((ExprLongLong)a).value()/((ExprUnsigLong)b).value()));
606       case ExprOperKind.eok_unsiglonglong:
607         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()/((ExprUnsigLongLong)b).value()));
608       case ExprOperKind.eok_octet:
609         return new ExprLongLongImpl((((ExprLongLong)a).value()/((ExprOctet)b).value()));
610       default: throw new TIRExceptCalculate("Can't calculate.");
611       }
612
613     case ExprOperKind.eok_unsigshort:
614       switch (b.get_eok_kind().value()) {
615       case ExprOperKind.eok_short:
616         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()/((ExprShort)b).value()));
617       case ExprOperKind.eok_long:
618         return new ExprLongImpl((((ExprUnsigShort)a).value()/((ExprLong)b).value()));
619       case ExprOperKind.eok_longlong:
620         return new ExprLongLongImpl((((ExprUnsigShort)a).value()/((ExprLongLong)b).value()));
621       case ExprOperKind.eok_unsigshort:
622         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()/((ExprUnsigShort)b).value())));
623       case ExprOperKind.eok_unsiglong:
624         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()/((ExprUnsigLong)b).value()));
625       case ExprOperKind.eok_unsiglonglong:
626         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()/((ExprUnsigLongLong)b).value()));
627       case ExprOperKind.eok_octet:
628         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()/((ExprOctet)b).value())));
629       default: throw new TIRExceptCalculate("Can't calculate.");
630       }
631
632     case ExprOperKind.eok_unsiglong:
633       switch (b.get_eok_kind().value()) {
634       case ExprOperKind.eok_short:
635         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()/((ExprShort)b).value()));
636       case ExprOperKind.eok_long:
637         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()/((ExprLong)b).value()));
638       case ExprOperKind.eok_longlong:
639         return new ExprLongLongImpl((((ExprUnsigLong)a).value()/((ExprLongLong)b).value()));
640       case ExprOperKind.eok_unsigshort:
641         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()/((ExprUnsigShort)b).value())));
642       case ExprOperKind.eok_unsiglong:
643         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()/((ExprUnsigLong)b).value()));
644       case ExprOperKind.eok_unsiglonglong:
645         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()/((ExprUnsigLongLong)b).value()));
646       case ExprOperKind.eok_octet:
647         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()/((ExprOctet)b).value()));
648       default: throw new TIRExceptCalculate("Can't calculate.");
649       }
650
651     case ExprOperKind.eok_unsiglonglong:
652       switch (b.get_eok_kind().value()) {
653       case ExprOperKind.eok_short:
654         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprShort)b).value()));
655       case ExprOperKind.eok_long:
656         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprLong)b).value()));
657       case ExprOperKind.eok_longlong:
658         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprLongLong)b).value()));
659       case ExprOperKind.eok_unsigshort:
660         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()/((ExprUnsigShort)b).value())));
661       case ExprOperKind.eok_unsiglong:
662         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprUnsigLong)b).value()));
663       case ExprOperKind.eok_unsiglonglong:
664         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprUnsigLongLong)b).value()));
665       case ExprOperKind.eok_octet:
666         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()/((ExprOctet)b).value()));
667       default: throw new TIRExceptCalculate("Can't calculate.");
668       }
669
670     case ExprOperKind.eok_octet:
671       switch (b.get_eok_kind().value()) {
672       case ExprOperKind.eok_short:
673         return new ExprShortImpl((short)(((ExprOctet)a).value()/((ExprShort)b).value()));
674       case ExprOperKind.eok_long:
675         return new ExprLongImpl((((ExprOctet)a).value()/((ExprLong)b).value()));
676       case ExprOperKind.eok_longlong:
677         return new ExprLongLongImpl((((ExprOctet)a).value()/((ExprLongLong)b).value()));
678       case ExprOperKind.eok_unsigshort:
679         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()/((ExprUnsigShort)b).value())));
680       case ExprOperKind.eok_unsiglong:
681         return new ExprUnsigLongImpl((((ExprOctet)a).value()/((ExprUnsigLong)b).value()));
682       case ExprOperKind.eok_unsiglonglong:
683         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()/((ExprUnsigLongLong)b).value()));
684       case ExprOperKind.eok_octet:
685         return new ExprOctetImpl((byte)((((ExprOctet)a).value()/((ExprOctet)b).value())));
686       default: throw new TIRExceptCalculate("Can't calculate.");
687       }
688
689     case ExprOperKind.eok_float:
690       switch (b.get_eok_kind().value()) {
691       case ExprOperKind.eok_float:
692         return new ExprFloatImpl(((ExprFloat)a).value()/((ExprFloat)b).value());
693       case ExprOperKind.eok_double:
694         return new ExprDoubleImpl(((ExprFloat)a).value()/((ExprDouble)b).value());
695       default: throw new TIRExceptCalculate("Can't calculate.");
696       }
697
698     case ExprOperKind.eok_double:
699       switch (b.get_eok_kind().value()) {
700       case ExprOperKind.eok_float:
701         return new ExprDoubleImpl(((ExprDouble)a).value()/((ExprFloat)b).value());
702       case ExprOperKind.eok_double:
703         return new ExprDoubleImpl(((ExprDouble)a).value()/((ExprDouble)b).value());
704       default: throw new TIRExceptCalculate("Can't calculate.");
705       }
706
707     case ExprOperKind.eok_fixed:
708       switch (b.get_eok_kind().value()) {
709       case ExprOperKind.eok_fixed:
710         int d1 = ((ExprFixed)a).digits();
711         int s1 = ((ExprFixed)a).scale();
712         int d2 = ((ExprFixed)b).digits();
713         int s2 = ((ExprFixed)b).scale();
714         int d = d1-s1+s2+Short.MAX_VALUE;
715         int s = Short.MAX_VALUE;
716         if (d>31) {
717           d = 31; s = 31-d+s;
718         }
719         return new ExprFixedImpl(((ExprFixed)a).value().divide(((ExprFixed)b).value(),s,java.math.BigDecimal.ROUND_HALF_UP),d,s);
720       default: throw new TIRExceptCalculate("Can't calculate.");
721       }
722     default: throw new TIRExceptCalculate("Can't calculate.");
723     }
724   }
725
726   public static ExprOperDef or(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
727     switch (a.get_eok_kind().value()) {
728     case ExprOperKind.eok_short:
729       switch (b.get_eok_kind().value()) {
730       case ExprOperKind.eok_short:
731         return new ExprShortImpl((short)(((ExprShort)a).value()|((ExprShort)b).value()));
732       case ExprOperKind.eok_long:
733         return new ExprLongImpl((((ExprShort)a).value()|((ExprLong)b).value()));
734       case ExprOperKind.eok_longlong:
735         return new ExprLongLongImpl((((ExprShort)a).value()|((ExprLongLong)b).value()));
736       case ExprOperKind.eok_unsigshort:
737         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()|((ExprUnsigShort)b).value())));
738       case ExprOperKind.eok_unsiglong:
739         return new ExprUnsigLongImpl((((ExprShort)a).value()|((ExprUnsigLong)b).value()));
740       case ExprOperKind.eok_unsiglonglong:
741         return new ExprUnsigLongLongImpl((((ExprShort)a).value()|((ExprUnsigLongLong)b).value()));
742       case ExprOperKind.eok_octet:
743         return new ExprShortImpl((short)((((ExprShort)a).value()|((ExprOctet)b).value())));
744       default: throw new TIRExceptCalculate("Can't calculate.");
745       }
746
747     case ExprOperKind.eok_long:
748       switch (b.get_eok_kind().value()) {
749       case ExprOperKind.eok_short:
750         return new ExprLongImpl((((ExprLong)a).value()|((ExprShort)b).value()));
751       case ExprOperKind.eok_long:
752         return new ExprLongImpl((((ExprLong)a).value()|((ExprLong)b).value()));
753       case ExprOperKind.eok_longlong:
754         return new ExprLongLongImpl((((ExprLong)a).value()|((ExprLongLong)b).value()));
755       case ExprOperKind.eok_unsigshort:
756         return new ExprLongImpl(((((ExprLong)a).value()|((ExprUnsigShort)b).value())));
757       case ExprOperKind.eok_unsiglong:
758         return new ExprUnsigLongImpl((((ExprLong)a).value()|((ExprUnsigLong)b).value()));
759       case ExprOperKind.eok_unsiglonglong:
760         return new ExprUnsigLongLongImpl((((ExprLong)a).value()|((ExprUnsigLongLong)b).value()));
761       case ExprOperKind.eok_octet:
762         return new ExprLongImpl((((ExprLong)a).value()|((ExprOctet)b).value()));
763       default: throw new TIRExceptCalculate("Can't calculate.");
764       }
765
766     case ExprOperKind.eok_longlong:
767       switch (b.get_eok_kind().value()) {
768       case ExprOperKind.eok_short:
769         return new ExprLongLongImpl((((ExprLongLong)a).value()|((ExprShort)b).value()));
770       case ExprOperKind.eok_long:
771         return new ExprLongLongImpl((((ExprLongLong)a).value()|((ExprLong)b).value()));
772       case ExprOperKind.eok_longlong:
773         return new ExprLongLongImpl((((ExprLongLong)a).value()|((ExprLongLong)b).value()));
774       case ExprOperKind.eok_unsigshort:
775         return new ExprLongLongImpl(((((ExprLongLong)a).value()|((ExprUnsigShort)b).value())));
776       case ExprOperKind.eok_unsiglong:
777         return new ExprLongLongImpl((((ExprLongLong)a).value()|((ExprUnsigLong)b).value()));
778       case ExprOperKind.eok_unsiglonglong:
779         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()|((ExprUnsigLongLong)b).value()));
780       case ExprOperKind.eok_octet:
781         return new ExprLongLongImpl((((ExprLongLong)a).value()|((ExprOctet)b).value()));
782       default: throw new TIRExceptCalculate("Can't calculate.");
783       }
784
785     case ExprOperKind.eok_unsigshort:
786       switch (b.get_eok_kind().value()) {
787       case ExprOperKind.eok_short:
788         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()|((ExprShort)b).value()));
789       case ExprOperKind.eok_long:
790         return new ExprLongImpl((((ExprUnsigShort)a).value()|((ExprLong)b).value()));
791       case ExprOperKind.eok_longlong:
792         return new ExprLongLongImpl((((ExprUnsigShort)a).value()|((ExprLongLong)b).value()));
793       case ExprOperKind.eok_unsigshort:
794         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()|((ExprUnsigShort)b).value())));
795       case ExprOperKind.eok_unsiglong:
796         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()|((ExprUnsigLong)b).value()));
797       case ExprOperKind.eok_unsiglonglong:
798         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()|((ExprUnsigLongLong)b).value()));
799       case ExprOperKind.eok_octet:
800         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()|((ExprOctet)b).value())));
801       default: throw new TIRExceptCalculate("Can't calculate.");
802       }
803
804     case ExprOperKind.eok_unsiglong:
805       switch (b.get_eok_kind().value()) {
806       case ExprOperKind.eok_short:
807         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()|((ExprShort)b).value()));
808       case ExprOperKind.eok_long:
809         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()|((ExprLong)b).value()));
810       case ExprOperKind.eok_longlong:
811         return new ExprLongLongImpl((((ExprUnsigLong)a).value()|((ExprLongLong)b).value()));
812       case ExprOperKind.eok_unsigshort:
813         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()|((ExprUnsigShort)b).value())));
814       case ExprOperKind.eok_unsiglong:
815         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()|((ExprUnsigLong)b).value()));
816       case ExprOperKind.eok_unsiglonglong:
817         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()|((ExprUnsigLongLong)b).value()));
818       case ExprOperKind.eok_octet:
819         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()|((ExprOctet)b).value()));
820       default: throw new TIRExceptCalculate("Can't calculate.");
821       }
822
823     case ExprOperKind.eok_unsiglonglong:
824       switch (b.get_eok_kind().value()) {
825       case ExprOperKind.eok_short:
826         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprShort)b).value()));
827       case ExprOperKind.eok_long:
828         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprLong)b).value()));
829       case ExprOperKind.eok_longlong:
830         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprLongLong)b).value()));
831       case ExprOperKind.eok_unsigshort:
832         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()|((ExprUnsigShort)b).value())));
833       case ExprOperKind.eok_unsiglong:
834         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprUnsigLong)b).value()));
835       case ExprOperKind.eok_unsiglonglong:
836         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprUnsigLongLong)b).value()));
837       case ExprOperKind.eok_octet:
838         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()|((ExprOctet)b).value()));
839       default: throw new TIRExceptCalculate("Can't calculate.");
840       }
841
842     case ExprOperKind.eok_octet:
843       switch (b.get_eok_kind().value()) {
844       case ExprOperKind.eok_short:
845         return new ExprShortImpl((short)(((ExprOctet)a).value()|((ExprShort)b).value()));
846       case ExprOperKind.eok_long:
847         return new ExprLongImpl((((ExprOctet)a).value()|((ExprLong)b).value()));
848       case ExprOperKind.eok_longlong:
849         return new ExprLongLongImpl((((ExprOctet)a).value()|((ExprLongLong)b).value()));
850       case ExprOperKind.eok_unsigshort:
851         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()|((ExprUnsigShort)b).value())));
852       case ExprOperKind.eok_unsiglong:
853         return new ExprUnsigLongImpl((((ExprOctet)a).value()|((ExprUnsigLong)b).value()));
854       case ExprOperKind.eok_unsiglonglong:
855         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()|((ExprUnsigLongLong)b).value()));
856       case ExprOperKind.eok_octet:
857         return new ExprOctetImpl((byte)((((ExprOctet)a).value()|((ExprOctet)b).value())));
858       default: throw new TIRExceptCalculate("Can't calculate.");
859       }
860
861     default: throw new TIRExceptCalculate("Can't calculate.");
862     }
863   }
864
865   public static ExprOperDef xor(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
866     switch (a.get_eok_kind().value()) {
867     case ExprOperKind.eok_short:
868       switch (b.get_eok_kind().value()) {
869       case ExprOperKind.eok_short:
870         return new ExprShortImpl((short)(((ExprShort)a).value()^((ExprShort)b).value()));
871       case ExprOperKind.eok_long:
872         return new ExprLongImpl((((ExprShort)a).value()^((ExprLong)b).value()));
873       case ExprOperKind.eok_longlong:
874         return new ExprLongLongImpl((((ExprShort)a).value()^((ExprLongLong)b).value()));
875       case ExprOperKind.eok_unsigshort:
876         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()^((ExprUnsigShort)b).value())));
877       case ExprOperKind.eok_unsiglong:
878         return new ExprUnsigLongImpl((((ExprShort)a).value()^((ExprUnsigLong)b).value()));
879       case ExprOperKind.eok_unsiglonglong:
880         return new ExprUnsigLongLongImpl((((ExprShort)a).value()^((ExprUnsigLongLong)b).value()));
881       case ExprOperKind.eok_octet:
882         return new ExprShortImpl((short)((((ExprShort)a).value()^((ExprOctet)b).value())));
883       default: throw new TIRExceptCalculate("Can't calculate.");
884       }
885
886     case ExprOperKind.eok_long:
887       switch (b.get_eok_kind().value()) {
888       case ExprOperKind.eok_short:
889         return new ExprLongImpl((((ExprLong)a).value()^((ExprShort)b).value()));
890       case ExprOperKind.eok_long:
891         return new ExprLongImpl((((ExprLong)a).value()^((ExprLong)b).value()));
892       case ExprOperKind.eok_longlong:
893         return new ExprLongLongImpl((((ExprLong)a).value()^((ExprLongLong)b).value()));
894       case ExprOperKind.eok_unsigshort:
895         return new ExprLongImpl(((((ExprLong)a).value()^((ExprUnsigShort)b).value())));
896       case ExprOperKind.eok_unsiglong:
897         return new ExprUnsigLongImpl((((ExprLong)a).value()^((ExprUnsigLong)b).value()));
898       case ExprOperKind.eok_unsiglonglong:
899         return new ExprUnsigLongLongImpl((((ExprLong)a).value()^((ExprUnsigLongLong)b).value()));
900       case ExprOperKind.eok_octet:
901         return new ExprLongImpl((((ExprLong)a).value()^((ExprOctet)b).value()));
902       default: throw new TIRExceptCalculate("Can't calculate.");
903       }
904
905     case ExprOperKind.eok_longlong:
906       switch (b.get_eok_kind().value()) {
907       case ExprOperKind.eok_short:
908         return new ExprLongLongImpl((((ExprLongLong)a).value()^((ExprShort)b).value()));
909       case ExprOperKind.eok_long:
910         return new ExprLongLongImpl((((ExprLongLong)a).value()^((ExprLong)b).value()));
911       case ExprOperKind.eok_longlong:
912         return new ExprLongLongImpl((((ExprLongLong)a).value()^((ExprLongLong)b).value()));
913       case ExprOperKind.eok_unsigshort:
914         return new ExprLongLongImpl(((((ExprLongLong)a).value()^((ExprUnsigShort)b).value())));
915       case ExprOperKind.eok_unsiglong:
916         return new ExprLongLongImpl((((ExprLongLong)a).value()^((ExprUnsigLong)b).value()));
917       case ExprOperKind.eok_unsiglonglong:
918         return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()^((ExprUnsigLongLong)b).value()));
919       case ExprOperKind.eok_octet:
920         return new ExprLongLongImpl((((ExprLongLong)a).value()^((ExprOctet)b).value()));
921       default: throw new TIRExceptCalculate("Can't calculate.");
922       }
923
924     case ExprOperKind.eok_unsigshort:
925       switch (b.get_eok_kind().value()) {
926       case ExprOperKind.eok_short:
927         return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()^((ExprShort)b).value()));
928       case ExprOperKind.eok_long:
929         return new ExprLongImpl((((ExprUnsigShort)a).value()^((ExprLong)b).value()));
930       case ExprOperKind.eok_longlong:
931         return new ExprLongLongImpl((((ExprUnsigShort)a).value()^((ExprLongLong)b).value()));
932       case ExprOperKind.eok_unsigshort:
933         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()^((ExprUnsigShort)b).value())));
934       case ExprOperKind.eok_unsiglong:
935         return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()^((ExprUnsigLong)b).value()));
936       case ExprOperKind.eok_unsiglonglong:
937         return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()^((ExprUnsigLongLong)b).value()));
938       case ExprOperKind.eok_octet:
939         return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()^((ExprOctet)b).value())));
940       default: throw new TIRExceptCalculate("Can't calculate.");
941       }
942
943     case ExprOperKind.eok_unsiglong:
944       switch (b.get_eok_kind().value()) {
945       case ExprOperKind.eok_short:
946         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()^((ExprShort)b).value()));
947       case ExprOperKind.eok_long:
948         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()^((ExprLong)b).value()));
949       case ExprOperKind.eok_longlong:
950         return new ExprLongLongImpl((((ExprUnsigLong)a).value()^((ExprLongLong)b).value()));
951       case ExprOperKind.eok_unsigshort:
952         return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()^((ExprUnsigShort)b).value())));
953       case ExprOperKind.eok_unsiglong:
954         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()^((ExprUnsigLong)b).value()));
955       case ExprOperKind.eok_unsiglonglong:
956         return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()^((ExprUnsigLongLong)b).value()));
957       case ExprOperKind.eok_octet:
958         return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()^((ExprOctet)b).value()));
959       default: throw new TIRExceptCalculate("Can't calculate.");
960       }
961
962     case ExprOperKind.eok_unsiglonglong:
963       switch (b.get_eok_kind().value()) {
964       case ExprOperKind.eok_short:
965         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprShort)b).value()));
966       case ExprOperKind.eok_long:
967         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprLong)b).value()));
968       case ExprOperKind.eok_longlong:
969         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprLongLong)b).value()));
970       case ExprOperKind.eok_unsigshort:
971         return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()^((ExprUnsigShort)b).value())));
972       case ExprOperKind.eok_unsiglong:
973         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprUnsigLong)b).value()));
974       case ExprOperKind.eok_unsiglonglong:
975         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprUnsigLongLong)b).value()));
976       case ExprOperKind.eok_octet:
977         return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()^((ExprOctet)b).value()));
978       default: throw new TIRExceptCalculate("Can't calculate.");
979       }
980
981     case ExprOperKind.eok_octet:
982       switch (b.get_eok_kind().value()) {
983       case ExprOperKind.eok_short:
984         return new ExprShortImpl((short)(((ExprOctet)a).value()^((ExprShort)b).value()));
985       case ExprOperKind.eok_long:
986         return new ExprLongImpl((((ExprOctet)a).value()^((ExprLong)b).value()));
987       case ExprOperKind.eok_longlong:
988         return new ExprLongLongImpl((((ExprOctet)a).value()^((ExprLongLong)b).value()));
989       case ExprOperKind.eok_unsigshort:
990         return new ExprUnsigShortImpl((short)((((ExprShort)a).value()^((ExprUnsigShort)b).value())));
991       case ExprOperKind.eok_unsiglong:
992         return new ExprUnsigLongImpl((((ExprOctet)a).value()^((ExprUnsigLong)b).value()));
993       case ExprOperKind.eok_unsiglonglong:
994         return new ExprUnsigLongLongImpl((((ExprOctet)a).value()^((ExprUnsigLongLong)b).value()));
995       case ExprOperKind.eok_octet:
996         return new ExprOctetImpl((byte)((((ExprOctet)a).value()^((ExprOctet)b).value())));
997       default: throw new TIRExceptCalculate("Can't calculate.");
998       }
999
1000    default: throw new TIRExceptCalculate("Can't calculate.");
1001    }
1002  }
1003
1004  public static ExprOperDef and(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
1005    switch (a.get_eok_kind().value()) {
1006    case ExprOperKind.eok_short:
1007      switch (b.get_eok_kind().value()) {
1008      case ExprOperKind.eok_short:
1009        return new ExprShortImpl((short)(((ExprShort)a).value()&((ExprShort)b).value()));
1010      case ExprOperKind.eok_long:
1011        return new ExprLongImpl((((ExprShort)a).value()&((ExprLong)b).value()));
1012      case ExprOperKind.eok_longlong:
1013        return new ExprLongLongImpl((((ExprShort)a).value()&((ExprLongLong)b).value()));
1014      case ExprOperKind.eok_unsigshort:
1015        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()&((ExprUnsigShort)b).value())));
1016      case ExprOperKind.eok_unsiglong:
1017        return new ExprUnsigLongImpl((((ExprShort)a).value()&((ExprUnsigLong)b).value()));
1018      case ExprOperKind.eok_unsiglonglong:
1019        return new ExprUnsigLongLongImpl((((ExprShort)a).value()&((ExprUnsigLongLong)b).value()));
1020      case ExprOperKind.eok_octet:
1021        return new ExprShortImpl((short)((((ExprShort)a).value()&((ExprOctet)b).value())));
1022      default: throw new TIRExceptCalculate("Can't calculate.");
1023      }
1024
1025    case ExprOperKind.eok_long:
1026      switch (b.get_eok_kind().value()) {
1027      case ExprOperKind.eok_short:
1028        return new ExprLongImpl((((ExprLong)a).value()&((ExprShort)b).value()));
1029      case ExprOperKind.eok_long:
1030        return new ExprLongImpl((((ExprLong)a).value()&((ExprLong)b).value()));
1031      case ExprOperKind.eok_longlong:
1032        return new ExprLongLongImpl((((ExprLong)a).value()&((ExprLongLong)b).value()));
1033      case ExprOperKind.eok_unsigshort:
1034        return new ExprLongImpl(((((ExprLong)a).value()&((ExprUnsigShort)b).value())));
1035      case ExprOperKind.eok_unsiglong:
1036        return new ExprUnsigLongImpl((((ExprLong)a).value()&((ExprUnsigLong)b).value()));
1037      case ExprOperKind.eok_unsiglonglong:
1038        return new ExprUnsigLongLongImpl((((ExprLong)a).value()&((ExprUnsigLongLong)b).value()));
1039      case ExprOperKind.eok_octet:
1040        return new ExprLongImpl((((ExprLong)a).value()&((ExprOctet)b).value()));
1041      default: throw new TIRExceptCalculate("Can't calculate.");
1042      }
1043
1044    case ExprOperKind.eok_longlong:
1045      switch (b.get_eok_kind().value()) {
1046      case ExprOperKind.eok_short:
1047        return new ExprLongLongImpl((((ExprLongLong)a).value()&((ExprShort)b).value()));
1048      case ExprOperKind.eok_long:
1049        return new ExprLongLongImpl((((ExprLongLong)a).value()&((ExprLong)b).value()));
1050      case ExprOperKind.eok_longlong:
1051        return new ExprLongLongImpl((((ExprLongLong)a).value()&((ExprLongLong)b).value()));
1052      case ExprOperKind.eok_unsigshort:
1053        return new ExprLongLongImpl(((((ExprLongLong)a).value()&((ExprUnsigShort)b).value())));
1054      case ExprOperKind.eok_unsiglong:
1055        return new ExprLongLongImpl((((ExprLongLong)a).value()&((ExprUnsigLong)b).value()));
1056      case ExprOperKind.eok_unsiglonglong:
1057        return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()&((ExprUnsigLongLong)b).value()));
1058      case ExprOperKind.eok_octet:
1059        return new ExprLongLongImpl((((ExprLongLong)a).value()&((ExprOctet)b).value()));
1060      default: throw new TIRExceptCalculate("Can't calculate.");
1061      }
1062
1063    case ExprOperKind.eok_unsigshort:
1064      switch (b.get_eok_kind().value()) {
1065      case ExprOperKind.eok_short:
1066        return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()&((ExprShort)b).value()));
1067      case ExprOperKind.eok_long:
1068        return new ExprLongImpl((((ExprUnsigShort)a).value()&((ExprLong)b).value()));
1069      case ExprOperKind.eok_longlong:
1070        return new ExprLongLongImpl((((ExprUnsigShort)a).value()&((ExprLongLong)b).value()));
1071      case ExprOperKind.eok_unsigshort:
1072        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()&((ExprUnsigShort)b).value())));
1073      case ExprOperKind.eok_unsiglong:
1074        return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()&((ExprUnsigLong)b).value()));
1075      case ExprOperKind.eok_unsiglonglong:
1076        return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()&((ExprUnsigLongLong)b).value()));
1077      case ExprOperKind.eok_octet:
1078        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()&((ExprOctet)b).value())));
1079      default: throw new TIRExceptCalculate("Can't calculate.");
1080      }
1081
1082    case ExprOperKind.eok_unsiglong:
1083      switch (b.get_eok_kind().value()) {
1084      case ExprOperKind.eok_short:
1085        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()&((ExprShort)b).value()));
1086      case ExprOperKind.eok_long:
1087        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()&((ExprLong)b).value()));
1088      case ExprOperKind.eok_longlong:
1089        return new ExprLongLongImpl((((ExprUnsigLong)a).value()&((ExprLongLong)b).value()));
1090      case ExprOperKind.eok_unsigshort:
1091        return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()&((ExprUnsigShort)b).value())));
1092      case ExprOperKind.eok_unsiglong:
1093        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()&((ExprUnsigLong)b).value()));
1094      case ExprOperKind.eok_unsiglonglong:
1095        return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()&((ExprUnsigLongLong)b).value()));
1096      case ExprOperKind.eok_octet:
1097        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()&((ExprOctet)b).value()));
1098      default: throw new TIRExceptCalculate("Can't calculate.");
1099      }
1100
1101    case ExprOperKind.eok_unsiglonglong:
1102      switch (b.get_eok_kind().value()) {
1103      case ExprOperKind.eok_short:
1104        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprShort)b).value()));
1105      case ExprOperKind.eok_long:
1106        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprLong)b).value()));
1107      case ExprOperKind.eok_longlong:
1108        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprLongLong)b).value()));
1109      case ExprOperKind.eok_unsigshort:
1110        return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()&((ExprUnsigShort)b).value())));
1111      case ExprOperKind.eok_unsiglong:
1112        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprUnsigLong)b).value()));
1113      case ExprOperKind.eok_unsiglonglong:
1114        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprUnsigLongLong)b).value()));
1115      case ExprOperKind.eok_octet:
1116        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()&((ExprOctet)b).value()));
1117      default: throw new TIRExceptCalculate("Can't calculate.");
1118      }
1119
1120    case ExprOperKind.eok_octet:
1121      switch (b.get_eok_kind().value()) {
1122      case ExprOperKind.eok_short:
1123        return new ExprShortImpl((short)(((ExprOctet)a).value()&((ExprShort)b).value()));
1124      case ExprOperKind.eok_long:
1125        return new ExprLongImpl((((ExprOctet)a).value()&((ExprLong)b).value()));
1126      case ExprOperKind.eok_longlong:
1127        return new ExprLongLongImpl((((ExprOctet)a).value()&((ExprLongLong)b).value()));
1128      case ExprOperKind.eok_unsigshort:
1129        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()&((ExprUnsigShort)b).value())));
1130      case ExprOperKind.eok_unsiglong:
1131        return new ExprUnsigLongImpl((((ExprOctet)a).value()&((ExprUnsigLong)b).value()));
1132      case ExprOperKind.eok_unsiglonglong:
1133        return new ExprUnsigLongLongImpl((((ExprOctet)a).value()&((ExprUnsigLongLong)b).value()));
1134      case ExprOperKind.eok_octet:
1135        return new ExprOctetImpl((byte)((((ExprOctet)a).value()&((ExprOctet)b).value())));
1136      default: throw new TIRExceptCalculate("Can't calculate.");
1137      }
1138
1139    default: throw new TIRExceptCalculate("Can't calculate.");
1140    }
1141  }
1142
1143  public static ExprOperDef mod(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
1144    switch (a.get_eok_kind().value()) {
1145    case ExprOperKind.eok_short:
1146      switch (b.get_eok_kind().value()) {
1147      case ExprOperKind.eok_short:
1148        return new ExprShortImpl((short)(((ExprShort)a).value()%((ExprShort)b).value()));
1149      case ExprOperKind.eok_long:
1150        return new ExprLongImpl((((ExprShort)a).value()%((ExprLong)b).value()));
1151      case ExprOperKind.eok_longlong:
1152        return new ExprLongLongImpl((((ExprShort)a).value()%((ExprLongLong)b).value()));
1153      case ExprOperKind.eok_unsigshort:
1154        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()%((ExprUnsigShort)b).value())));
1155      case ExprOperKind.eok_unsiglong:
1156        return new ExprUnsigLongImpl((((ExprShort)a).value()%((ExprUnsigLong)b).value()));
1157      case ExprOperKind.eok_unsiglonglong:
1158        return new ExprUnsigLongLongImpl((((ExprShort)a).value()%((ExprUnsigLongLong)b).value()));
1159      case ExprOperKind.eok_octet:
1160        return new ExprShortImpl((short)((((ExprShort)a).value()%((ExprOctet)b).value())));
1161      default: throw new TIRExceptCalculate("Can't calculate.");
1162      }
1163
1164    case ExprOperKind.eok_long:
1165      switch (b.get_eok_kind().value()) {
1166      case ExprOperKind.eok_short:
1167        return new ExprLongImpl((((ExprLong)a).value()%((ExprShort)b).value()));
1168      case ExprOperKind.eok_long:
1169        return new ExprLongImpl((((ExprLong)a).value()%((ExprLong)b).value()));
1170      case ExprOperKind.eok_longlong:
1171        return new ExprLongLongImpl((((ExprLong)a).value()%((ExprLongLong)b).value()));
1172      case ExprOperKind.eok_unsigshort:
1173        return new ExprLongImpl(((((ExprLong)a).value()%((ExprUnsigShort)b).value())));
1174      case ExprOperKind.eok_unsiglong:
1175        return new ExprUnsigLongImpl((((ExprLong)a).value()%((ExprUnsigLong)b).value()));
1176      case ExprOperKind.eok_unsiglonglong:
1177        return new ExprUnsigLongLongImpl((((ExprLong)a).value()%((ExprUnsigLongLong)b).value()));
1178      case ExprOperKind.eok_octet:
1179        return new ExprLongImpl((((ExprLong)a).value()%((ExprOctet)b).value()));
1180      default: throw new TIRExceptCalculate("Can't calculate.");
1181      }
1182
1183    case ExprOperKind.eok_longlong:
1184      switch (b.get_eok_kind().value()) {
1185      case ExprOperKind.eok_short:
1186        return new ExprLongLongImpl((((ExprLongLong)a).value()%((ExprShort)b).value()));
1187      case ExprOperKind.eok_long:
1188        return new ExprLongLongImpl((((ExprLongLong)a).value()%((ExprLong)b).value()));
1189      case ExprOperKind.eok_longlong:
1190        return new ExprLongLongImpl((((ExprLongLong)a).value()%((ExprLongLong)b).value()));
1191      case ExprOperKind.eok_unsigshort:
1192        return new ExprLongLongImpl(((((ExprLongLong)a).value()%((ExprUnsigShort)b).value())));
1193      case ExprOperKind.eok_unsiglong:
1194        return new ExprLongLongImpl((((ExprLongLong)a).value()%((ExprUnsigLong)b).value()));
1195      case ExprOperKind.eok_unsiglonglong:
1196        return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()%((ExprUnsigLongLong)b).value()));
1197      case ExprOperKind.eok_octet:
1198        return new ExprLongLongImpl((((ExprLongLong)a).value()%((ExprOctet)b).value()));
1199      default: throw new TIRExceptCalculate("Can't calculate.");
1200      }
1201
1202    case ExprOperKind.eok_unsigshort:
1203      switch (b.get_eok_kind().value()) {
1204      case ExprOperKind.eok_short:
1205        return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()%((ExprShort)b).value()));
1206      case ExprOperKind.eok_long:
1207        return new ExprLongImpl((((ExprUnsigShort)a).value()%((ExprLong)b).value()));
1208      case ExprOperKind.eok_longlong:
1209        return new ExprLongLongImpl((((ExprUnsigShort)a).value()%((ExprLongLong)b).value()));
1210      case ExprOperKind.eok_unsigshort:
1211        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()%((ExprUnsigShort)b).value())));
1212      case ExprOperKind.eok_unsiglong:
1213        return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()%((ExprUnsigLong)b).value()));
1214      case ExprOperKind.eok_unsiglonglong:
1215        return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()%((ExprUnsigLongLong)b).value()));
1216      case ExprOperKind.eok_octet:
1217        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()%((ExprOctet)b).value())));
1218      default: throw new TIRExceptCalculate("Can't calculate.");
1219      }
1220
1221    case ExprOperKind.eok_unsiglong:
1222      switch (b.get_eok_kind().value()) {
1223      case ExprOperKind.eok_short:
1224        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()%((ExprShort)b).value()));
1225      case ExprOperKind.eok_long:
1226        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()%((ExprLong)b).value()));
1227      case ExprOperKind.eok_longlong:
1228        return new ExprLongLongImpl((((ExprUnsigLong)a).value()%((ExprLongLong)b).value()));
1229      case ExprOperKind.eok_unsigshort:
1230        return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()%((ExprUnsigShort)b).value())));
1231      case ExprOperKind.eok_unsiglong:
1232        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()%((ExprUnsigLong)b).value()));
1233      case ExprOperKind.eok_unsiglonglong:
1234        return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()%((ExprUnsigLongLong)b).value()));
1235      case ExprOperKind.eok_octet:
1236        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()%((ExprOctet)b).value()));
1237      default: throw new TIRExceptCalculate("Can't calculate.");
1238      }
1239
1240    case ExprOperKind.eok_unsiglonglong:
1241      switch (b.get_eok_kind().value()) {
1242      case ExprOperKind.eok_short:
1243        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprShort)b).value()));
1244      case ExprOperKind.eok_long:
1245        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprLong)b).value()));
1246      case ExprOperKind.eok_longlong:
1247        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprLongLong)b).value()));
1248      case ExprOperKind.eok_unsigshort:
1249        return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()%((ExprUnsigShort)b).value())));
1250      case ExprOperKind.eok_unsiglong:
1251        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprUnsigLong)b).value()));
1252      case ExprOperKind.eok_unsiglonglong:
1253        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprUnsigLongLong)b).value()));
1254      case ExprOperKind.eok_octet:
1255        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()%((ExprOctet)b).value()));
1256      default: throw new TIRExceptCalculate("Can't calculate.");
1257      }
1258
1259    case ExprOperKind.eok_octet:
1260      switch (b.get_eok_kind().value()) {
1261      case ExprOperKind.eok_short:
1262        return new ExprShortImpl((short)(((ExprOctet)a).value()%((ExprShort)b).value()));
1263      case ExprOperKind.eok_long:
1264        return new ExprLongImpl((((ExprOctet)a).value()%((ExprLong)b).value()));
1265      case ExprOperKind.eok_longlong:
1266        return new ExprLongLongImpl((((ExprOctet)a).value()%((ExprLongLong)b).value()));
1267      case ExprOperKind.eok_unsigshort:
1268        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()%((ExprUnsigShort)b).value())));
1269      case ExprOperKind.eok_unsiglong:
1270        return new ExprUnsigLongImpl((((ExprOctet)a).value()%((ExprUnsigLong)b).value()));
1271      case ExprOperKind.eok_unsiglonglong:
1272        return new ExprUnsigLongLongImpl((((ExprOctet)a).value()%((ExprUnsigLongLong)b).value()));
1273      case ExprOperKind.eok_octet:
1274        return new ExprOctetImpl((byte)((((ExprOctet)a).value()%((ExprOctet)b).value())));
1275      default: throw new TIRExceptCalculate("Can't calculate.");
1276      }
1277
1278    default: throw new TIRExceptCalculate("Can't calculate.");
1279    }
1280  }
1281
1282  public static ExprOperDef shr(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
1283    switch (a.get_eok_kind().value()) {
1284    case ExprOperKind.eok_short:
1285      switch (b.get_eok_kind().value()) {
1286      case ExprOperKind.eok_short:
1287        return new ExprShortImpl((short)(((ExprShort)a).value()>>((ExprShort)b).value()));
1288      case ExprOperKind.eok_long:
1289        return new ExprLongImpl((((ExprShort)a).value()>>((ExprLong)b).value()));
1290      case ExprOperKind.eok_longlong:
1291        return new ExprLongLongImpl((((ExprShort)a).value()>>((ExprLongLong)b).value()));
1292      case ExprOperKind.eok_unsigshort:
1293        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()>>((ExprUnsigShort)b).value())));
1294      case ExprOperKind.eok_unsiglong:
1295        return new ExprUnsigLongImpl((((ExprShort)a).value()>>((ExprUnsigLong)b).value()));
1296      case ExprOperKind.eok_unsiglonglong:
1297        return new ExprUnsigLongLongImpl((((ExprShort)a).value()>>((ExprUnsigLongLong)b).value()));
1298      case ExprOperKind.eok_octet:
1299        return new ExprShortImpl((short)((((ExprShort)a).value()>>((ExprOctet)b).value())));
1300      default: throw new TIRExceptCalculate("Can't calculate.");
1301      }
1302
1303    case ExprOperKind.eok_long:
1304      switch (b.get_eok_kind().value()) {
1305      case ExprOperKind.eok_short:
1306        return new ExprLongImpl((((ExprLong)a).value()>>((ExprShort)b).value()));
1307      case ExprOperKind.eok_long:
1308        return new ExprLongImpl((((ExprLong)a).value()>>((ExprLong)b).value()));
1309      case ExprOperKind.eok_longlong:
1310        return new ExprLongLongImpl((((ExprLong)a).value()>>((ExprLongLong)b).value()));
1311      case ExprOperKind.eok_unsigshort:
1312        return new ExprLongImpl(((((ExprLong)a).value()>>((ExprUnsigShort)b).value())));
1313      case ExprOperKind.eok_unsiglong:
1314        return new ExprUnsigLongImpl((((ExprLong)a).value()>>((ExprUnsigLong)b).value()));
1315      case ExprOperKind.eok_unsiglonglong:
1316        return new ExprUnsigLongLongImpl((((ExprLong)a).value()>>((ExprUnsigLongLong)b).value()));
1317      case ExprOperKind.eok_octet:
1318        return new ExprLongImpl((((ExprLong)a).value()>>((ExprOctet)b).value()));
1319      default: throw new TIRExceptCalculate("Can't calculate.");
1320      }
1321
1322    case ExprOperKind.eok_longlong:
1323      switch (b.get_eok_kind().value()) {
1324      case ExprOperKind.eok_short:
1325        return new ExprLongLongImpl((((ExprLongLong)a).value()>>((ExprShort)b).value()));
1326      case ExprOperKind.eok_long:
1327        return new ExprLongLongImpl((((ExprLongLong)a).value()>>((ExprLong)b).value()));
1328      case ExprOperKind.eok_longlong:
1329        return new ExprLongLongImpl((((ExprLongLong)a).value()>>((ExprLongLong)b).value()));
1330      case ExprOperKind.eok_unsigshort:
1331        return new ExprLongLongImpl(((((ExprLongLong)a).value()>>((ExprUnsigShort)b).value())));
1332      case ExprOperKind.eok_unsiglong:
1333        return new ExprLongLongImpl((((ExprLongLong)a).value()>>((ExprUnsigLong)b).value()));
1334      case ExprOperKind.eok_unsiglonglong:
1335        return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()>>((ExprUnsigLongLong)b).value()));
1336      case ExprOperKind.eok_octet:
1337        return new ExprLongLongImpl((((ExprLongLong)a).value()>>((ExprOctet)b).value()));
1338      default: throw new TIRExceptCalculate("Can't calculate.");
1339      }
1340
1341    case ExprOperKind.eok_unsigshort:
1342      switch (b.get_eok_kind().value()) {
1343      case ExprOperKind.eok_short:
1344        return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()>>((ExprShort)b).value()));
1345      case ExprOperKind.eok_long:
1346        return new ExprLongImpl((((ExprUnsigShort)a).value()>>((ExprLong)b).value()));
1347      case ExprOperKind.eok_longlong:
1348        return new ExprLongLongImpl((((ExprUnsigShort)a).value()>>((ExprLongLong)b).value()));
1349      case ExprOperKind.eok_unsigshort:
1350        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()>>((ExprUnsigShort)b).value())));
1351      case ExprOperKind.eok_unsiglong:
1352        return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()>>((ExprUnsigLong)b).value()));
1353      case ExprOperKind.eok_unsiglonglong:
1354        return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()>>((ExprUnsigLongLong)b).value()));
1355      case ExprOperKind.eok_octet:
1356        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()>>((ExprOctet)b).value())));
1357      default: throw new TIRExceptCalculate("Can't calculate.");
1358      }
1359
1360    case ExprOperKind.eok_unsiglong:
1361      switch (b.get_eok_kind().value()) {
1362      case ExprOperKind.eok_short:
1363        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()>>((ExprShort)b).value()));
1364      case ExprOperKind.eok_long:
1365        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()>>((ExprLong)b).value()));
1366      case ExprOperKind.eok_longlong:
1367        return new ExprLongLongImpl((((ExprUnsigLong)a).value()>>((ExprLongLong)b).value()));
1368      case ExprOperKind.eok_unsigshort:
1369        return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()>>((ExprUnsigShort)b).value())));
1370      case ExprOperKind.eok_unsiglong:
1371        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()>>((ExprUnsigLong)b).value()));
1372      case ExprOperKind.eok_unsiglonglong:
1373        return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()>>((ExprUnsigLongLong)b).value()));
1374      case ExprOperKind.eok_octet:
1375        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()>>((ExprOctet)b).value()));
1376      default: throw new TIRExceptCalculate("Can't calculate.");
1377      }
1378
1379    case ExprOperKind.eok_unsiglonglong:
1380      switch (b.get_eok_kind().value()) {
1381      case ExprOperKind.eok_short:
1382        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprShort)b).value()));
1383      case ExprOperKind.eok_long:
1384        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprLong)b).value()));
1385      case ExprOperKind.eok_longlong:
1386        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprLongLong)b).value()));
1387      case ExprOperKind.eok_unsigshort:
1388        return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()>>((ExprUnsigShort)b).value())));
1389      case ExprOperKind.eok_unsiglong:
1390        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprUnsigLong)b).value()));
1391      case ExprOperKind.eok_unsiglonglong:
1392        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprUnsigLongLong)b).value()));
1393      case ExprOperKind.eok_octet:
1394        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()>>((ExprOctet)b).value()));
1395      default: throw new TIRExceptCalculate("Can't calculate.");
1396      }
1397
1398    case ExprOperKind.eok_octet:
1399      switch (b.get_eok_kind().value()) {
1400      case ExprOperKind.eok_short:
1401        return new ExprShortImpl((short)(((ExprOctet)a).value()>>((ExprShort)b).value()));
1402      case ExprOperKind.eok_long:
1403        return new ExprLongImpl((((ExprOctet)a).value()>>((ExprLong)b).value()));
1404      case ExprOperKind.eok_longlong:
1405        return new ExprLongLongImpl((((ExprOctet)a).value()>>((ExprLongLong)b).value()));
1406      case ExprOperKind.eok_unsigshort:
1407        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()>>((ExprUnsigShort)b).value())));
1408      case ExprOperKind.eok_unsiglong:
1409        return new ExprUnsigLongImpl((((ExprOctet)a).value()>>((ExprUnsigLong)b).value()));
1410      case ExprOperKind.eok_unsiglonglong:
1411        return new ExprUnsigLongLongImpl((((ExprOctet)a).value()>>((ExprUnsigLongLong)b).value()));
1412      case ExprOperKind.eok_octet:
1413        return new ExprOctetImpl((byte)((((ExprOctet)a).value()>>((ExprOctet)b).value())));
1414      default: throw new TIRExceptCalculate("Can't calculate.");
1415      }
1416
1417    default: throw new TIRExceptCalculate("Can't calculate.");
1418    }
1419  }
1420
1421  public static ExprOperDef shl(ExprOperDef a, ExprOperDef b) throws RemoteException, TIRExceptCalculate {
1422    switch (a.get_eok_kind().value()) {
1423    case ExprOperKind.eok_short:
1424      switch (b.get_eok_kind().value()) {
1425      case ExprOperKind.eok_short:
1426        return new ExprShortImpl((short)(((ExprShort)a).value()<<((ExprShort)b).value()));
1427      case ExprOperKind.eok_long:
1428        return new ExprLongImpl((((ExprShort)a).value()<<((ExprLong)b).value()));
1429      case ExprOperKind.eok_longlong:
1430        return new ExprLongLongImpl((((ExprShort)a).value()<<((ExprLongLong)b).value()));
1431      case ExprOperKind.eok_unsigshort:
1432        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()<<((ExprUnsigShort)b).value())));
1433      case ExprOperKind.eok_unsiglong:
1434        return new ExprUnsigLongImpl((((ExprShort)a).value()<<((ExprUnsigLong)b).value()));
1435      case ExprOperKind.eok_unsiglonglong:
1436        return new ExprUnsigLongLongImpl((((ExprShort)a).value()<<((ExprUnsigLongLong)b).value()));
1437      case ExprOperKind.eok_octet:
1438        return new ExprShortImpl((short)((((ExprShort)a).value()<<((ExprOctet)b).value())));
1439      default: throw new TIRExceptCalculate("Can't calculate.");
1440      }
1441
1442    case ExprOperKind.eok_long:
1443      switch (b.get_eok_kind().value()) {
1444      case ExprOperKind.eok_short:
1445        return new ExprLongImpl((((ExprLong)a).value()<<((ExprShort)b).value()));
1446      case ExprOperKind.eok_long:
1447        return new ExprLongImpl((((ExprLong)a).value()<<((ExprLong)b).value()));
1448      case ExprOperKind.eok_longlong:
1449        return new ExprLongLongImpl((((ExprLong)a).value()<<((ExprLongLong)b).value()));
1450      case ExprOperKind.eok_unsigshort:
1451        return new ExprLongImpl(((((ExprLong)a).value()<<((ExprUnsigShort)b).value())));
1452      case ExprOperKind.eok_unsiglong:
1453        return new ExprUnsigLongImpl((((ExprLong)a).value()<<((ExprUnsigLong)b).value()));
1454      case ExprOperKind.eok_unsiglonglong:
1455        return new ExprUnsigLongLongImpl((((ExprLong)a).value()<<((ExprUnsigLongLong)b).value()));
1456      case ExprOperKind.eok_octet:
1457        return new ExprLongImpl((((ExprLong)a).value()<<((ExprOctet)b).value()));
1458      default: throw new TIRExceptCalculate("Can't calculate.");
1459      }
1460
1461    case ExprOperKind.eok_longlong:
1462      switch (b.get_eok_kind().value()) {
1463      case ExprOperKind.eok_short:
1464        return new ExprLongLongImpl((((ExprLongLong)a).value()<<((ExprShort)b).value()));
1465      case ExprOperKind.eok_long:
1466        return new ExprLongLongImpl((((ExprLongLong)a).value()<<((ExprLong)b).value()));
1467      case ExprOperKind.eok_longlong:
1468        return new ExprLongLongImpl((((ExprLongLong)a).value()<<((ExprLongLong)b).value()));
1469      case ExprOperKind.eok_unsigshort:
1470        return new ExprLongLongImpl(((((ExprLongLong)a).value()<<((ExprUnsigShort)b).value())));
1471      case ExprOperKind.eok_unsiglong:
1472        return new ExprLongLongImpl((((ExprLongLong)a).value()<<((ExprUnsigLong)b).value()));
1473      case ExprOperKind.eok_unsiglonglong:
1474        return new ExprUnsigLongLongImpl((((ExprLongLong)a).value()<<((ExprUnsigLongLong)b).value()));
1475      case ExprOperKind.eok_octet:
1476        return new ExprLongLongImpl((((ExprLongLong)a).value()<<((ExprOctet)b).value()));
1477      default: throw new TIRExceptCalculate("Can't calculate.");
1478      }
1479
1480    case ExprOperKind.eok_unsigshort:
1481      switch (b.get_eok_kind().value()) {
1482      case ExprOperKind.eok_short:
1483        return new ExprUnsigShortImpl((short)(((ExprUnsigShort)a).value()<<((ExprShort)b).value()));
1484      case ExprOperKind.eok_long:
1485        return new ExprLongImpl((((ExprUnsigShort)a).value()<<((ExprLong)b).value()));
1486      case ExprOperKind.eok_longlong:
1487        return new ExprLongLongImpl((((ExprUnsigShort)a).value()<<((ExprLongLong)b).value()));
1488      case ExprOperKind.eok_unsigshort:
1489        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()<<((ExprUnsigShort)b).value())));
1490      case ExprOperKind.eok_unsiglong:
1491        return new ExprUnsigLongImpl((((ExprUnsigShort)a).value()<<((ExprUnsigLong)b).value()));
1492      case ExprOperKind.eok_unsiglonglong:
1493        return new ExprUnsigLongLongImpl((((ExprUnsigShort)a).value()<<((ExprUnsigLongLong)b).value()));
1494      case ExprOperKind.eok_octet:
1495        return new ExprUnsigShortImpl((short)((((ExprUnsigShort)a).value()<<((ExprOctet)b).value())));
1496      default: throw new TIRExceptCalculate("Can't calculate.");
1497      }
1498
1499    case ExprOperKind.eok_unsiglong:
1500      switch (b.get_eok_kind().value()) {
1501      case ExprOperKind.eok_short:
1502        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()<<((ExprShort)b).value()));
1503      case ExprOperKind.eok_long:
1504        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()<<((ExprLong)b).value()));
1505      case ExprOperKind.eok_longlong:
1506        return new ExprLongLongImpl((((ExprUnsigLong)a).value()<<((ExprLongLong)b).value()));
1507      case ExprOperKind.eok_unsigshort:
1508        return new ExprUnsigLongImpl(((((ExprUnsigLong)a).value()<<((ExprUnsigShort)b).value())));
1509      case ExprOperKind.eok_unsiglong:
1510        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()<<((ExprUnsigLong)b).value()));
1511      case ExprOperKind.eok_unsiglonglong:
1512        return new ExprUnsigLongLongImpl((((ExprUnsigLong)a).value()<<((ExprUnsigLongLong)b).value()));
1513      case ExprOperKind.eok_octet:
1514        return new ExprUnsigLongImpl((((ExprUnsigLong)a).value()<<((ExprOctet)b).value()));
1515      default: throw new TIRExceptCalculate("Can't calculate.");
1516      }
1517
1518    case ExprOperKind.eok_unsiglonglong:
1519      switch (b.get_eok_kind().value()) {
1520      case ExprOperKind.eok_short:
1521        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprShort)b).value()));
1522      case ExprOperKind.eok_long:
1523        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprLong)b).value()));
1524      case ExprOperKind.eok_longlong:
1525        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprLongLong)b).value()));
1526      case ExprOperKind.eok_unsigshort:
1527        return new ExprUnsigLongLongImpl(((((ExprUnsigLongLong)a).value()<<((ExprUnsigShort)b).value())));
1528      case ExprOperKind.eok_unsiglong:
1529        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprUnsigLong)b).value()));
1530      case ExprOperKind.eok_unsiglonglong:
1531        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprUnsigLongLong)b).value()));
1532      case ExprOperKind.eok_octet:
1533        return new ExprUnsigLongLongImpl((((ExprUnsigLongLong)a).value()<<((ExprOctet)b).value()));
1534      default: throw new TIRExceptCalculate("Can't calculate.");
1535      }
1536
1537    case ExprOperKind.eok_octet:
1538      switch (b.get_eok_kind().value()) {
1539      case ExprOperKind.eok_short:
1540        return new ExprShortImpl((short)(((ExprOctet)a).value()<<((ExprShort)b).value()));
1541      case ExprOperKind.eok_long:
1542        return new ExprLongImpl((((ExprOctet)a).value()<<((ExprLong)b).value()));
1543      case ExprOperKind.eok_longlong:
1544        return new ExprLongLongImpl((((ExprOctet)a).value()<<((ExprLongLong)b).value()));
1545      case ExprOperKind.eok_unsigshort:
1546        return new ExprUnsigShortImpl((short)((((ExprShort)a).value()<<((ExprUnsigShort)b).value())));
1547      case ExprOperKind.eok_unsiglong:
1548        return new ExprUnsigLongImpl((((ExprOctet)a).value()<<((ExprUnsigLong)b).value()));
1549      case ExprOperKind.eok_unsiglonglong:
1550        return new ExprUnsigLongLongImpl((((ExprOctet)a).value()<<((ExprUnsigLongLong)b).value()));
1551      case ExprOperKind.eok_octet:
1552        return new ExprOctetImpl((byte)((((ExprOctet)a).value()<<((ExprOctet)b).value())));
1553      default: throw new TIRExceptCalculate("Can't calculate.");
1554      }
1555
1556    default: throw new TIRExceptCalculate("Can't calculate.");
1557    }
1558  }
1559
1560  static public ExprOperDef toNormal(ExprOperDef expr) throws RemoteException {
1561    if (expr == null)
1562      return null;
1563    switch (expr.get_eok_kind().value()) {
1564    case ExprOperKind.eok_or:
1565    case ExprOperKind.eok_xor:
1566    case ExprOperKind.eok_and:
1567    case ExprOperKind.eok_shr:
1568    case ExprOperKind.eok_shl:
1569    case ExprOperKind.eok_plus:
1570    case ExprOperKind.eok_minus:
1571    case ExprOperKind.eok_mul:
1572    case ExprOperKind.eok_div:
1573    case ExprOperKind.eok_mod:
1574      ExprOperDef o1 = toNormal(((ExprBinOperationDef) expr).operand1());
1575      ExprOperDef o2 = toNormal(((ExprBinOperationDef) expr).operand2());
1576      return new ExprBinOperationDefImpl(expr.get_eok_kind().value(), o1, o2);
1577    case ExprOperKind.eok_unminus:
1578    case ExprOperKind.eok_unplus:
1579    case ExprOperKind.eok_untilde:
1580      ExprOperDef o = toNormal(((ExprUnOperationDef) expr).operand());
1581      return new ExprUnOperationDefImpl(expr.get_eok_kind().value(), o);
1582    case ExprOperKind.eok_short:
1583      return new ExprShortImpl(((ExprShort) expr).value());
1584    case ExprOperKind.eok_long:
1585      return new ExprLongImpl(((ExprLong) expr).value());
1586    case ExprOperKind.eok_longlong:
1587      return new ExprLongLongImpl(((ExprLongLong) expr).value());
1588    case ExprOperKind.eok_unsigshort:
1589      return new ExprUnsigShortImpl(((ExprUnsigShort) expr).value());
1590    case ExprOperKind.eok_unsiglong:
1591      return new ExprUnsigLongImpl(((ExprUnsigLong) expr).value());
1592    case ExprOperKind.eok_unsiglonglong:
1593      return new ExprUnsigLongLongImpl(((ExprUnsigLongLong) expr).value());
1594    case ExprOperKind.eok_float:
1595      return new ExprFloatImpl(((ExprFloat) expr).value());
1596    case ExprOperKind.eok_double:
1597      return new ExprDoubleImpl(((ExprDouble) expr).value());
1598    case ExprOperKind.eok_longdouble:
1599      //return new ExprLongDoubleImpl(((ExprLongDouble) expr).value());
1600
return null;
1601    case ExprOperKind.eok_fixed:
1602      return new ExprFixedImpl(((ExprFixed) expr).value(), ((ExprFixed) expr).digits(), ((ExprFixed) expr).scale());
1603    case ExprOperKind.eok_property:
1604      return new ExprPropertyImpl(((ExprProperty) expr).ref_prop());
1605    case ExprOperKind.eok_constant:
1606      return new ExprConstantImpl(((ExprConstant) expr).ref_const());
1607    case ExprOperKind.eok_valuegen:
1608      ValueGenImpl ret = new ValueGenImpl(StateKind.sk_work);
1609      ValueGenElement[] els = ((ValueGen) expr).elements();
1610      for(int i=0;i<els.length;i++) {
1611        ret.addListItem(new ValueGenElementImpl(toNormal(els[i].expr1()), toNormal(els[i].expr2())));
1612      }
1613      return ret;
1614    case ExprOperKind.eok_enum:
1615      return new ExprEnumImpl(((ExprEnum) expr).enum(), new String(((ExprEnum) expr).value()));
1616    case ExprOperKind.eok_octet:
1617      return new ExprOctetImpl(((ExprOctet) expr).value());
1618    case ExprOperKind.eok_char:
1619      return new ExprCharImpl(((ExprChar) expr).value());
1620    case ExprOperKind.eok_wchar:
1621      return new ExprWcharImpl(((ExprWchar) expr).value());
1622    case ExprOperKind.eok_string:
1623      return new ExprStringImpl(new String(((ExprString) expr).value()));
1624    case ExprOperKind.eok_wstring:
1625      return new ExprWstringImpl(new String(((ExprWstring) expr).value()));
1626    case ExprOperKind.eok_default:
1627      return new ExprDefaultImpl(StateKind.sk_work);
1628    case ExprOperKind.eok_boolean:
1629      return new ExprBooleanImpl(((ExprBoolean) expr).value());
1630    }
1631
1632    return null;
1633  }
1634}
1635
Popular Tags