infraruby-java 0.0.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2a4e9327a7765473984c6cf1a3020ce09975f54
4
- data.tar.gz: f49db3ee97ee2d71c94454ba799191d0fa4ac937
3
+ metadata.gz: 695340b8f639541a70db860991e6deb3109f2766
4
+ data.tar.gz: 1decaa512ad372408cf4b704101fbe61829c6371
5
5
  SHA512:
6
- metadata.gz: 5b6a002d8a3b439d2687b7aacab90d77f058d2e10645530470dfea8ce76bfafd9b36a327c9f66b316454ad90f755d2b2adf8e02899efb631ea162a376ba1b581
7
- data.tar.gz: 68fe4898a5d25c50759bc1c7720ddd1eb74d219d0b9089370777ecd7fbab2c1af4261eac5d6411de32d7482ee3b3a39b48f34d07bb3aef7e4d386c31e65f7920
6
+ metadata.gz: 2f47f678b456c392b293b4f6100becc97cb34e4c88655cfb8722eee16d6e3b1808d21cc2d93a32cfb7d157bd8203365350ee5c06689336aa1a4b9e350b75cac5
7
+ data.tar.gz: 0fd2c27090641306e1abc09a28e86556bb4afdd0b59fa9652ec9b56f0d66e2d74c082b4d28693b2bf214c8738cf675875ec6efcf0130a68b3f889a8f8425a2f4
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011-2015 InfraRuby Vision
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19
+ DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ InfraRuby Java integration for Ruby interpreters
2
+ ================================================
3
+
4
+ This gem provides the InfraRuby Java integration for Ruby interpreters.
5
+
6
+
7
+ Example
8
+ -------
9
+
10
+ require "infraruby-java"
11
+
12
+ c1 = Int32[1]
13
+ c2 = Int32[2]
14
+ puts c1 + c2
15
+
16
+
17
+ Support
18
+ -------
19
+
20
+ InfraRuby Vision
21
+ rubygems@infraruby.com
22
+
23
+ http://infraruby.com/
24
+ https://github.com/InfraRuby
25
+ https://twitter.com/InfraRuby
@@ -0,0 +1,2023 @@
1
+ package primitive;
2
+ import org.jruby.Ruby;
3
+ import org.jruby.RubyClass;
4
+ import org.jruby.RubyObject;
5
+ import org.jruby.RubyBoolean;
6
+ import org.jruby.RubyInteger;
7
+ import org.jruby.RubyFixnum;
8
+ import org.jruby.RubyBignum;
9
+ import org.jruby.RubyFloat;
10
+ import org.jruby.RubyString;
11
+ import org.jruby.anno.JRubyMethod;
12
+ import org.jruby.runtime.Block;
13
+ import org.jruby.runtime.ObjectAllocator;
14
+ import org.jruby.runtime.ThreadContext;
15
+ import org.jruby.runtime.builtin.IRubyObject;
16
+ import org.jruby.runtime.load.BasicLibraryService;
17
+ import org.jruby.util.ByteList;
18
+ import org.jcodings.specific.ASCIIEncoding;
19
+ import org.jcodings.specific.USASCIIEncoding;
20
+ public class PrimitiveService implements BasicLibraryService {
21
+ static RubyBignum Integer_x8000000000000000;
22
+ static RubyBignum Integer_xFFFFFFFFFFFFFFFF;
23
+ static RubyFixnum Integer_xM8000000000000000;
24
+ static Int32 Int32_0;
25
+ static Int32 Int32_1;
26
+ static Int32 Int32_M1;
27
+ static RubyClass ByteClass;
28
+ static RubyClass CharClass;
29
+ static RubyClass Int16Class;
30
+ static RubyClass Int32Class;
31
+ static RubyClass Int64Class;
32
+ static RubyClass Float32Class;
33
+ static RubyClass Float64Class;
34
+ public static int __int32_div(Ruby runtime, int x, int y) {
35
+ if (y == 0)
36
+ throw runtime.newZeroDivisionError();
37
+ return x / y;
38
+ }
39
+ public static int __int32_mod(Ruby runtime, int x, int y) {
40
+ if (y == 0)
41
+ throw runtime.newZeroDivisionError();
42
+ return x % y;
43
+ }
44
+ public static long __int64_div(Ruby runtime, long x, long y) {
45
+ if (y == 0)
46
+ throw runtime.newZeroDivisionError();
47
+ return x / y;
48
+ }
49
+ public static long __int64_mod(Ruby runtime, long x, long y) {
50
+ if (y == 0)
51
+ throw runtime.newZeroDivisionError();
52
+ return x % y;
53
+ }
54
+ public static float __float32_div(Ruby runtime, float x, float y) {
55
+ return x / y;
56
+ }
57
+ public static float __float32_mod(Ruby runtime, float x, float y) {
58
+ return x % y;
59
+ }
60
+ public static double __float64_div(Ruby runtime, double x, double y) {
61
+ return x / y;
62
+ }
63
+ public static double __float64_mod(Ruby runtime, double x, double y) {
64
+ return x % y;
65
+ }
66
+ static long __bignum_to_int64(Ruby runtime, IRubyObject o) {
67
+ ThreadContext context = runtime.getCurrentContext();
68
+ o = Integer_x8000000000000000.op_plus(context, o);
69
+ o = Integer_xFFFFFFFFFFFFFFFF.op_and(context, o);
70
+ o = Integer_xM8000000000000000.op_plus(context, o);
71
+ return ((RubyInteger) o).getLongValue();
72
+ }
73
+ public static int __object_i32(Ruby runtime, IRubyObject o) {
74
+ if (o instanceof Byte)
75
+ return (int) ((Byte) o).value;
76
+ if (o instanceof Char)
77
+ return (int) ((Char) o).value;
78
+ if (o instanceof Int16)
79
+ return (int) ((Int16) o).value;
80
+ if (o instanceof Int32)
81
+ return (int) ((Int32) o).value;
82
+ if (o instanceof RubyFixnum)
83
+ return (int) ((RubyFixnum) o).getLongValue();
84
+ if (o instanceof RubyBignum)
85
+ return (int) __bignum_to_int64(runtime, o);
86
+ throw runtime.newTypeError("expected int32");
87
+ }
88
+ public static long __object_i64(Ruby runtime, IRubyObject o) {
89
+ if (o instanceof Int64)
90
+ return (long) ((Int64) o).value;
91
+ if (o instanceof RubyFixnum)
92
+ return (long) ((RubyFixnum) o).getLongValue();
93
+ if (o instanceof RubyBignum)
94
+ return (long) __bignum_to_int64(runtime, o);
95
+ throw runtime.newTypeError("expected int64");
96
+ }
97
+ public static float __object_f32(Ruby runtime, IRubyObject o) {
98
+ if (o instanceof Float32)
99
+ return (float) ((Float32) o).value;
100
+ if (o instanceof RubyFixnum)
101
+ return (float) ((RubyFixnum) o).getLongValue();
102
+ if (o instanceof RubyBignum)
103
+ return (float) ((RubyBignum) o).getDoubleValue();
104
+ if (o instanceof RubyFloat)
105
+ return (float) ((RubyFloat) o).getDoubleValue();
106
+ throw runtime.newTypeError("expected float32");
107
+ }
108
+ public static double __object_f64(Ruby runtime, IRubyObject o) {
109
+ if (o instanceof Float64)
110
+ return (double) ((Float64) o).value;
111
+ if (o instanceof RubyFixnum)
112
+ return (double) ((RubyFixnum) o).getLongValue();
113
+ if (o instanceof RubyBignum)
114
+ return (double) ((RubyBignum) o).getDoubleValue();
115
+ if (o instanceof RubyFloat)
116
+ return (double) ((RubyFloat) o).getDoubleValue();
117
+ throw runtime.newTypeError("expected float64");
118
+ }
119
+ static final java.nio.charset.Charset CHARSET_US_ASCII = java.nio.charset.Charset.forName("US-ASCII");
120
+ public static int __int32_hash(int value) {
121
+ return value;
122
+ }
123
+ public static RubyInteger __int32_to_i(Ruby runtime, int value) {
124
+ return RubyFixnum.newFixnum(runtime, (long) value);
125
+ }
126
+ public static RubyFloat __int32_to_f(Ruby runtime, int value) {
127
+ return RubyFloat.newFloat(runtime, (double) value);
128
+ }
129
+ public static ByteList __int32_to_s(Ruby runtime, int value) {
130
+ return new ByteList(Integer.toString(value).getBytes(CHARSET_US_ASCII), USASCIIEncoding.INSTANCE);
131
+ }
132
+ public static ByteList __int32_to_hex(Ruby runtime, int value) {
133
+ int n = 010;
134
+ byte[] m = new byte[n];
135
+ while (true) {
136
+ n -= 1;
137
+ int c = (int) value & 0x0F;
138
+ m[n] = (byte) (c < 10 ? c + 0x30 : c + 0x41 - 10);
139
+ if (n == 0)
140
+ break;
141
+ value >>= 4;
142
+ }
143
+ return new ByteList(m, USASCIIEncoding.INSTANCE);
144
+ }
145
+ public static ByteList __int32_chr(Ruby runtime, int value) {
146
+ if (value < 0x00)
147
+ throw runtime.newRangeError("out of range");
148
+ if (value <= 0x7F)
149
+ return new ByteList(new byte[] { (byte) value }, USASCIIEncoding.INSTANCE);
150
+ if (value <= 0xFF)
151
+ return new ByteList(new byte[] { (byte) value }, ASCIIEncoding.INSTANCE);
152
+ throw runtime.newRangeError("out of range");
153
+ }
154
+ public static int __int64_hash(long value) {
155
+ return (int) value ^ (int) (value >> 32);
156
+ }
157
+ public static RubyInteger __int64_to_i(Ruby runtime, long value) {
158
+ return RubyFixnum.newFixnum(runtime, (long) value);
159
+ }
160
+ public static RubyFloat __int64_to_f(Ruby runtime, long value) {
161
+ return RubyFloat.newFloat(runtime, (double) value);
162
+ }
163
+ public static ByteList __int64_to_s(Ruby runtime, long value) {
164
+ return new ByteList(java.lang.Long.toString(value).getBytes(CHARSET_US_ASCII), USASCIIEncoding.INSTANCE);
165
+ }
166
+ public static ByteList __int64_to_hex(Ruby runtime, long value) {
167
+ int n = 020;
168
+ byte[] m = new byte[n];
169
+ while (true) {
170
+ n -= 1;
171
+ int c = (int) value & 0x0F;
172
+ m[n] = (byte) (c < 10 ? c + 0x30 : c + 0x41 - 10);
173
+ if (n == 0)
174
+ break;
175
+ value >>= 4;
176
+ }
177
+ return new ByteList(m, USASCIIEncoding.INSTANCE);
178
+ }
179
+ public static ByteList __int64_chr(Ruby runtime, long value) {
180
+ if (value < 0x00)
181
+ throw runtime.newRangeError("out of range");
182
+ if (value <= 0x7F)
183
+ return new ByteList(new byte[] { (byte) value }, USASCIIEncoding.INSTANCE);
184
+ if (value <= 0xFF)
185
+ return new ByteList(new byte[] { (byte) value }, ASCIIEncoding.INSTANCE);
186
+ throw runtime.newRangeError("out of range");
187
+ }
188
+ public static int __float32_hash(float value) {
189
+ return __int32_hash(java.lang.Float.floatToRawIntBits(value));
190
+ }
191
+ public static RubyInteger __float32_to_i(Ruby runtime, float value) {
192
+ if (Float.isNaN(value))
193
+ throw runtime.newFloatDomainError("NaN");
194
+ if (Float.isInfinite(value))
195
+ throw runtime.newFloatDomainError(value < 0 ? "-Infinity" : "Infinity");
196
+ if (value < RubyFixnum.MIN || value >= RubyFixnum.MAX)
197
+ return RubyBignum.newBignum(runtime, value);
198
+ return RubyFixnum.newFixnum(runtime, (long) value);
199
+ }
200
+ public static RubyFloat __float32_to_f(Ruby runtime, float value) {
201
+ return RubyFloat.newFloat(runtime, (double) value);
202
+ }
203
+ public static ByteList __float32_to_s(Ruby runtime, float value) {
204
+ return new ByteList(Float.toString(value).getBytes(CHARSET_US_ASCII), USASCIIEncoding.INSTANCE);
205
+ }
206
+ public static int __float64_hash(double value) {
207
+ return __int64_hash(java.lang.Double.doubleToRawLongBits(value));
208
+ }
209
+ public static RubyInteger __float64_to_i(Ruby runtime, double value) {
210
+ if (Double.isNaN(value))
211
+ throw runtime.newFloatDomainError("NaN");
212
+ if (Double.isInfinite(value))
213
+ throw runtime.newFloatDomainError(value < 0 ? "-Infinity" : "Infinity");
214
+ if (value < RubyFixnum.MIN || value >= RubyFixnum.MAX)
215
+ return RubyBignum.newBignum(runtime, value);
216
+ return RubyFixnum.newFixnum(runtime, (long) value);
217
+ }
218
+ public static RubyFloat __float64_to_f(Ruby runtime, double value) {
219
+ return RubyFloat.newFloat(runtime, (double) value);
220
+ }
221
+ public static ByteList __float64_to_s(Ruby runtime, double value) {
222
+ return new ByteList(Double.toString(value).getBytes(CHARSET_US_ASCII), USASCIIEncoding.INSTANCE);
223
+ }
224
+ public static class Byte extends RubyObject {
225
+ @JRubyMethod(name = "[]", meta = true)
226
+ public static Byte get(IRubyObject self, IRubyObject o) {
227
+ RubyClass klass = (RubyClass) self;
228
+ Ruby runtime = klass.getRuntime();
229
+ int v = PrimitiveService.__object_i32(runtime, o);
230
+ return new Byte(klass, v);
231
+ }
232
+ final byte value;
233
+ public Byte(RubyClass klass, int value) {
234
+ super(klass);
235
+ this.value = (byte) value;
236
+ return;
237
+ }
238
+ @Override
239
+ public java.lang.Object toJava(java.lang.Class target) {
240
+ return value;
241
+ }
242
+ @JRubyMethod(name = "eql?")
243
+ public RubyBoolean is_eql(IRubyObject o) {
244
+ Ruby runtime = getRuntime();
245
+ if (o instanceof Byte) {
246
+ byte v = ((Byte) o).value;
247
+ return RubyBoolean.newBoolean(runtime, value == v);
248
+ }
249
+ return RubyBoolean.newBoolean(runtime, false);
250
+ }
251
+ @JRubyMethod
252
+ public RubyFixnum hash() {
253
+ Ruby runtime = getRuntime();
254
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__int32_hash(value));
255
+ }
256
+ @JRubyMethod
257
+ public Byte to_byte() {
258
+ Ruby runtime = getRuntime();
259
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
260
+ }
261
+ @JRubyMethod
262
+ public Char to_char() {
263
+ Ruby runtime = getRuntime();
264
+ return new Char(PrimitiveService.CharClass, (char) value);
265
+ }
266
+ @JRubyMethod
267
+ public Int16 to_int16() {
268
+ Ruby runtime = getRuntime();
269
+ return new Int16(PrimitiveService.Int16Class, (short) value);
270
+ }
271
+ @JRubyMethod
272
+ public Int32 to_int32() {
273
+ Ruby runtime = getRuntime();
274
+ return new Int32(PrimitiveService.Int32Class, (int) value);
275
+ }
276
+ @JRubyMethod
277
+ public Int64 to_int64() {
278
+ Ruby runtime = getRuntime();
279
+ return new Int64(PrimitiveService.Int64Class, (long) value);
280
+ }
281
+ @JRubyMethod
282
+ public Float32 to_float32() {
283
+ Ruby runtime = getRuntime();
284
+ return new Float32(PrimitiveService.Float32Class, (float) value);
285
+ }
286
+ @JRubyMethod
287
+ public Float64 to_float64() {
288
+ Ruby runtime = getRuntime();
289
+ return new Float64(PrimitiveService.Float64Class, (double) value);
290
+ }
291
+ @JRubyMethod
292
+ public RubyInteger as_i() {
293
+ Ruby runtime = getRuntime();
294
+ return PrimitiveService.__int32_to_i(runtime, value);
295
+ }
296
+ @JRubyMethod
297
+ public RubyFloat as_f() {
298
+ Ruby runtime = getRuntime();
299
+ return PrimitiveService.__int32_to_f(runtime, value);
300
+ }
301
+ @JRubyMethod
302
+ public RubyInteger to_i() {
303
+ Ruby runtime = getRuntime();
304
+ return PrimitiveService.__int32_to_i(runtime, value);
305
+ }
306
+ @JRubyMethod
307
+ public RubyInteger to_int() {
308
+ Ruby runtime = getRuntime();
309
+ return PrimitiveService.__int32_to_i(runtime, value);
310
+ }
311
+ @JRubyMethod
312
+ public RubyFloat to_f() {
313
+ Ruby runtime = getRuntime();
314
+ return PrimitiveService.__int32_to_f(runtime, value);
315
+ }
316
+ @JRubyMethod
317
+ public RubyString to_s() {
318
+ Ruby runtime = getRuntime();
319
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
320
+ }
321
+ @JRubyMethod
322
+ public RubyString inspect() {
323
+ Ruby runtime = getRuntime();
324
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
325
+ }
326
+ @JRubyMethod(name = "==")
327
+ public RubyBoolean eq(IRubyObject o) {
328
+ Ruby runtime = getRuntime();
329
+ int v = PrimitiveService.__object_i32(runtime, o);
330
+ return RubyBoolean.newBoolean(runtime, value == v);
331
+ }
332
+ @JRubyMethod(name = "!=")
333
+ public RubyBoolean ne(IRubyObject o) {
334
+ Ruby runtime = getRuntime();
335
+ int v = PrimitiveService.__object_i32(runtime, o);
336
+ return RubyBoolean.newBoolean(runtime, value != v);
337
+ }
338
+ @JRubyMethod(name = "+@")
339
+ public Int32 pos() {
340
+ Ruby runtime = getRuntime();
341
+ return new Int32(PrimitiveService.Int32Class, +value);
342
+ }
343
+ @JRubyMethod(name = "-@")
344
+ public Int32 neg() {
345
+ Ruby runtime = getRuntime();
346
+ return new Int32(PrimitiveService.Int32Class, -value);
347
+ }
348
+ @JRubyMethod(name = "*")
349
+ public Int32 mul(IRubyObject o) {
350
+ Ruby runtime = getRuntime();
351
+ int v = PrimitiveService.__object_i32(runtime, o);
352
+ return new Int32(PrimitiveService.Int32Class, value * v);
353
+ }
354
+ @JRubyMethod(name = "/")
355
+ public Int32 div(IRubyObject o) {
356
+ Ruby runtime = getRuntime();
357
+ int v = PrimitiveService.__object_i32(runtime, o);
358
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_div(runtime, value, v));
359
+ }
360
+ @JRubyMethod(name = "%")
361
+ public Int32 mod(IRubyObject o) {
362
+ Ruby runtime = getRuntime();
363
+ int v = PrimitiveService.__object_i32(runtime, o);
364
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_mod(runtime, value, v));
365
+ }
366
+ @JRubyMethod(name = "+")
367
+ public Int32 add(IRubyObject o) {
368
+ Ruby runtime = getRuntime();
369
+ int v = PrimitiveService.__object_i32(runtime, o);
370
+ return new Int32(PrimitiveService.Int32Class, value + v);
371
+ }
372
+ @JRubyMethod(name = "-")
373
+ public Int32 sub(IRubyObject o) {
374
+ Ruby runtime = getRuntime();
375
+ int v = PrimitiveService.__object_i32(runtime, o);
376
+ return new Int32(PrimitiveService.Int32Class, value - v);
377
+ }
378
+ @JRubyMethod(name = "<=>")
379
+ public Int32 cmp(IRubyObject o) {
380
+ Ruby runtime = getRuntime();
381
+ int value = this.value;
382
+ int v = PrimitiveService.__object_i32(runtime, o);
383
+ if (value < v)
384
+ return PrimitiveService.Int32_M1;
385
+ if (value > v)
386
+ return PrimitiveService.Int32_1;
387
+ return PrimitiveService.Int32_0;
388
+ }
389
+ @JRubyMethod(name = "<")
390
+ public RubyBoolean lt(IRubyObject o) {
391
+ Ruby runtime = getRuntime();
392
+ int v = PrimitiveService.__object_i32(runtime, o);
393
+ return RubyBoolean.newBoolean(runtime, value < v);
394
+ }
395
+ @JRubyMethod(name = "<=")
396
+ public RubyBoolean le(IRubyObject o) {
397
+ Ruby runtime = getRuntime();
398
+ int v = PrimitiveService.__object_i32(runtime, o);
399
+ return RubyBoolean.newBoolean(runtime, value <= v);
400
+ }
401
+ @JRubyMethod(name = ">=")
402
+ public RubyBoolean ge(IRubyObject o) {
403
+ Ruby runtime = getRuntime();
404
+ int v = PrimitiveService.__object_i32(runtime, o);
405
+ return RubyBoolean.newBoolean(runtime, value >= v);
406
+ }
407
+ @JRubyMethod(name = ">")
408
+ public RubyBoolean gt(IRubyObject o) {
409
+ Ruby runtime = getRuntime();
410
+ int v = PrimitiveService.__object_i32(runtime, o);
411
+ return RubyBoolean.newBoolean(runtime, value > v);
412
+ }
413
+ @JRubyMethod(name = "~")
414
+ public Int32 inv() {
415
+ Ruby runtime = getRuntime();
416
+ return new Int32(PrimitiveService.Int32Class, ~value);
417
+ }
418
+ @JRubyMethod(name = "<<")
419
+ public Int32 shl(IRubyObject o) {
420
+ Ruby runtime = getRuntime();
421
+ int v = PrimitiveService.__object_i32(runtime, o);
422
+ return new Int32(PrimitiveService.Int32Class, value << v);
423
+ }
424
+ @JRubyMethod(name = ">>")
425
+ public Int32 shr(IRubyObject o) {
426
+ Ruby runtime = getRuntime();
427
+ int v = PrimitiveService.__object_i32(runtime, o);
428
+ return new Int32(PrimitiveService.Int32Class, value >> v);
429
+ }
430
+ @JRubyMethod(name = "ushr")
431
+ public Int32 ushr(IRubyObject o) {
432
+ Ruby runtime = getRuntime();
433
+ int v = PrimitiveService.__object_i32(runtime, o);
434
+ return new Int32(PrimitiveService.Int32Class, value >>> v);
435
+ }
436
+ @JRubyMethod(name = "&")
437
+ public Int32 and(IRubyObject o) {
438
+ Ruby runtime = getRuntime();
439
+ int v = PrimitiveService.__object_i32(runtime, o);
440
+ return new Int32(PrimitiveService.Int32Class, value & v);
441
+ }
442
+ @JRubyMethod(name = "^")
443
+ public Int32 xor(IRubyObject o) {
444
+ Ruby runtime = getRuntime();
445
+ int v = PrimitiveService.__object_i32(runtime, o);
446
+ return new Int32(PrimitiveService.Int32Class, value ^ v);
447
+ }
448
+ @JRubyMethod(name = "|")
449
+ public Int32 or(IRubyObject o) {
450
+ Ruby runtime = getRuntime();
451
+ int v = PrimitiveService.__object_i32(runtime, o);
452
+ return new Int32(PrimitiveService.Int32Class, value | v);
453
+ }
454
+ @JRubyMethod(name = "zero?")
455
+ public RubyBoolean is_zero() {
456
+ Ruby runtime = getRuntime();
457
+ return RubyBoolean.newBoolean(runtime, value == 0);
458
+ }
459
+ }
460
+ public static class Char extends RubyObject {
461
+ @JRubyMethod(name = "[]", meta = true)
462
+ public static Char get(IRubyObject self, IRubyObject o) {
463
+ RubyClass klass = (RubyClass) self;
464
+ Ruby runtime = klass.getRuntime();
465
+ int v = PrimitiveService.__object_i32(runtime, o);
466
+ return new Char(klass, v);
467
+ }
468
+ final char value;
469
+ public Char(RubyClass klass, int value) {
470
+ super(klass);
471
+ this.value = (char) value;
472
+ return;
473
+ }
474
+ @Override
475
+ public java.lang.Object toJava(java.lang.Class target) {
476
+ return value;
477
+ }
478
+ @JRubyMethod(name = "eql?")
479
+ public RubyBoolean is_eql(IRubyObject o) {
480
+ Ruby runtime = getRuntime();
481
+ if (o instanceof Char) {
482
+ char v = ((Char) o).value;
483
+ return RubyBoolean.newBoolean(runtime, value == v);
484
+ }
485
+ return RubyBoolean.newBoolean(runtime, false);
486
+ }
487
+ @JRubyMethod
488
+ public RubyFixnum hash() {
489
+ Ruby runtime = getRuntime();
490
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__int32_hash(value));
491
+ }
492
+ @JRubyMethod
493
+ public Byte to_byte() {
494
+ Ruby runtime = getRuntime();
495
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
496
+ }
497
+ @JRubyMethod
498
+ public Char to_char() {
499
+ Ruby runtime = getRuntime();
500
+ return new Char(PrimitiveService.CharClass, (char) value);
501
+ }
502
+ @JRubyMethod
503
+ public Int16 to_int16() {
504
+ Ruby runtime = getRuntime();
505
+ return new Int16(PrimitiveService.Int16Class, (short) value);
506
+ }
507
+ @JRubyMethod
508
+ public Int32 to_int32() {
509
+ Ruby runtime = getRuntime();
510
+ return new Int32(PrimitiveService.Int32Class, (int) value);
511
+ }
512
+ @JRubyMethod
513
+ public Int64 to_int64() {
514
+ Ruby runtime = getRuntime();
515
+ return new Int64(PrimitiveService.Int64Class, (long) value);
516
+ }
517
+ @JRubyMethod
518
+ public Float32 to_float32() {
519
+ Ruby runtime = getRuntime();
520
+ return new Float32(PrimitiveService.Float32Class, (float) value);
521
+ }
522
+ @JRubyMethod
523
+ public Float64 to_float64() {
524
+ Ruby runtime = getRuntime();
525
+ return new Float64(PrimitiveService.Float64Class, (double) value);
526
+ }
527
+ @JRubyMethod
528
+ public RubyInteger as_i() {
529
+ Ruby runtime = getRuntime();
530
+ return PrimitiveService.__int32_to_i(runtime, value);
531
+ }
532
+ @JRubyMethod
533
+ public RubyFloat as_f() {
534
+ Ruby runtime = getRuntime();
535
+ return PrimitiveService.__int32_to_f(runtime, value);
536
+ }
537
+ @JRubyMethod
538
+ public RubyInteger to_i() {
539
+ Ruby runtime = getRuntime();
540
+ return PrimitiveService.__int32_to_i(runtime, value);
541
+ }
542
+ @JRubyMethod
543
+ public RubyInteger to_int() {
544
+ Ruby runtime = getRuntime();
545
+ return PrimitiveService.__int32_to_i(runtime, value);
546
+ }
547
+ @JRubyMethod
548
+ public RubyFloat to_f() {
549
+ Ruby runtime = getRuntime();
550
+ return PrimitiveService.__int32_to_f(runtime, value);
551
+ }
552
+ @JRubyMethod
553
+ public RubyString to_s() {
554
+ Ruby runtime = getRuntime();
555
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
556
+ }
557
+ @JRubyMethod
558
+ public RubyString inspect() {
559
+ Ruby runtime = getRuntime();
560
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
561
+ }
562
+ @JRubyMethod(name = "==")
563
+ public RubyBoolean eq(IRubyObject o) {
564
+ Ruby runtime = getRuntime();
565
+ int v = PrimitiveService.__object_i32(runtime, o);
566
+ return RubyBoolean.newBoolean(runtime, value == v);
567
+ }
568
+ @JRubyMethod(name = "!=")
569
+ public RubyBoolean ne(IRubyObject o) {
570
+ Ruby runtime = getRuntime();
571
+ int v = PrimitiveService.__object_i32(runtime, o);
572
+ return RubyBoolean.newBoolean(runtime, value != v);
573
+ }
574
+ @JRubyMethod(name = "+@")
575
+ public Int32 pos() {
576
+ Ruby runtime = getRuntime();
577
+ return new Int32(PrimitiveService.Int32Class, +value);
578
+ }
579
+ @JRubyMethod(name = "-@")
580
+ public Int32 neg() {
581
+ Ruby runtime = getRuntime();
582
+ return new Int32(PrimitiveService.Int32Class, -value);
583
+ }
584
+ @JRubyMethod(name = "*")
585
+ public Int32 mul(IRubyObject o) {
586
+ Ruby runtime = getRuntime();
587
+ int v = PrimitiveService.__object_i32(runtime, o);
588
+ return new Int32(PrimitiveService.Int32Class, value * v);
589
+ }
590
+ @JRubyMethod(name = "/")
591
+ public Int32 div(IRubyObject o) {
592
+ Ruby runtime = getRuntime();
593
+ int v = PrimitiveService.__object_i32(runtime, o);
594
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_div(runtime, value, v));
595
+ }
596
+ @JRubyMethod(name = "%")
597
+ public Int32 mod(IRubyObject o) {
598
+ Ruby runtime = getRuntime();
599
+ int v = PrimitiveService.__object_i32(runtime, o);
600
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_mod(runtime, value, v));
601
+ }
602
+ @JRubyMethod(name = "+")
603
+ public Int32 add(IRubyObject o) {
604
+ Ruby runtime = getRuntime();
605
+ int v = PrimitiveService.__object_i32(runtime, o);
606
+ return new Int32(PrimitiveService.Int32Class, value + v);
607
+ }
608
+ @JRubyMethod(name = "-")
609
+ public Int32 sub(IRubyObject o) {
610
+ Ruby runtime = getRuntime();
611
+ int v = PrimitiveService.__object_i32(runtime, o);
612
+ return new Int32(PrimitiveService.Int32Class, value - v);
613
+ }
614
+ @JRubyMethod(name = "<=>")
615
+ public Int32 cmp(IRubyObject o) {
616
+ Ruby runtime = getRuntime();
617
+ int value = this.value;
618
+ int v = PrimitiveService.__object_i32(runtime, o);
619
+ if (value < v)
620
+ return PrimitiveService.Int32_M1;
621
+ if (value > v)
622
+ return PrimitiveService.Int32_1;
623
+ return PrimitiveService.Int32_0;
624
+ }
625
+ @JRubyMethod(name = "<")
626
+ public RubyBoolean lt(IRubyObject o) {
627
+ Ruby runtime = getRuntime();
628
+ int v = PrimitiveService.__object_i32(runtime, o);
629
+ return RubyBoolean.newBoolean(runtime, value < v);
630
+ }
631
+ @JRubyMethod(name = "<=")
632
+ public RubyBoolean le(IRubyObject o) {
633
+ Ruby runtime = getRuntime();
634
+ int v = PrimitiveService.__object_i32(runtime, o);
635
+ return RubyBoolean.newBoolean(runtime, value <= v);
636
+ }
637
+ @JRubyMethod(name = ">=")
638
+ public RubyBoolean ge(IRubyObject o) {
639
+ Ruby runtime = getRuntime();
640
+ int v = PrimitiveService.__object_i32(runtime, o);
641
+ return RubyBoolean.newBoolean(runtime, value >= v);
642
+ }
643
+ @JRubyMethod(name = ">")
644
+ public RubyBoolean gt(IRubyObject o) {
645
+ Ruby runtime = getRuntime();
646
+ int v = PrimitiveService.__object_i32(runtime, o);
647
+ return RubyBoolean.newBoolean(runtime, value > v);
648
+ }
649
+ @JRubyMethod(name = "~")
650
+ public Int32 inv() {
651
+ Ruby runtime = getRuntime();
652
+ return new Int32(PrimitiveService.Int32Class, ~value);
653
+ }
654
+ @JRubyMethod(name = "<<")
655
+ public Int32 shl(IRubyObject o) {
656
+ Ruby runtime = getRuntime();
657
+ int v = PrimitiveService.__object_i32(runtime, o);
658
+ return new Int32(PrimitiveService.Int32Class, value << v);
659
+ }
660
+ @JRubyMethod(name = ">>")
661
+ public Int32 shr(IRubyObject o) {
662
+ Ruby runtime = getRuntime();
663
+ int v = PrimitiveService.__object_i32(runtime, o);
664
+ return new Int32(PrimitiveService.Int32Class, value >> v);
665
+ }
666
+ @JRubyMethod(name = "ushr")
667
+ public Int32 ushr(IRubyObject o) {
668
+ Ruby runtime = getRuntime();
669
+ int v = PrimitiveService.__object_i32(runtime, o);
670
+ return new Int32(PrimitiveService.Int32Class, value >>> v);
671
+ }
672
+ @JRubyMethod(name = "&")
673
+ public Int32 and(IRubyObject o) {
674
+ Ruby runtime = getRuntime();
675
+ int v = PrimitiveService.__object_i32(runtime, o);
676
+ return new Int32(PrimitiveService.Int32Class, value & v);
677
+ }
678
+ @JRubyMethod(name = "^")
679
+ public Int32 xor(IRubyObject o) {
680
+ Ruby runtime = getRuntime();
681
+ int v = PrimitiveService.__object_i32(runtime, o);
682
+ return new Int32(PrimitiveService.Int32Class, value ^ v);
683
+ }
684
+ @JRubyMethod(name = "|")
685
+ public Int32 or(IRubyObject o) {
686
+ Ruby runtime = getRuntime();
687
+ int v = PrimitiveService.__object_i32(runtime, o);
688
+ return new Int32(PrimitiveService.Int32Class, value | v);
689
+ }
690
+ @JRubyMethod(name = "zero?")
691
+ public RubyBoolean is_zero() {
692
+ Ruby runtime = getRuntime();
693
+ return RubyBoolean.newBoolean(runtime, value == 0);
694
+ }
695
+ }
696
+ public static class Int16 extends RubyObject {
697
+ @JRubyMethod(name = "[]", meta = true)
698
+ public static Int16 get(IRubyObject self, IRubyObject o) {
699
+ RubyClass klass = (RubyClass) self;
700
+ Ruby runtime = klass.getRuntime();
701
+ int v = PrimitiveService.__object_i32(runtime, o);
702
+ return new Int16(klass, v);
703
+ }
704
+ final short value;
705
+ public Int16(RubyClass klass, int value) {
706
+ super(klass);
707
+ this.value = (short) value;
708
+ return;
709
+ }
710
+ @Override
711
+ public java.lang.Object toJava(java.lang.Class target) {
712
+ return value;
713
+ }
714
+ @JRubyMethod(name = "eql?")
715
+ public RubyBoolean is_eql(IRubyObject o) {
716
+ Ruby runtime = getRuntime();
717
+ if (o instanceof Int16) {
718
+ short v = ((Int16) o).value;
719
+ return RubyBoolean.newBoolean(runtime, value == v);
720
+ }
721
+ return RubyBoolean.newBoolean(runtime, false);
722
+ }
723
+ @JRubyMethod
724
+ public RubyFixnum hash() {
725
+ Ruby runtime = getRuntime();
726
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__int32_hash(value));
727
+ }
728
+ @JRubyMethod
729
+ public Byte to_byte() {
730
+ Ruby runtime = getRuntime();
731
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
732
+ }
733
+ @JRubyMethod
734
+ public Char to_char() {
735
+ Ruby runtime = getRuntime();
736
+ return new Char(PrimitiveService.CharClass, (char) value);
737
+ }
738
+ @JRubyMethod
739
+ public Int16 to_int16() {
740
+ Ruby runtime = getRuntime();
741
+ return new Int16(PrimitiveService.Int16Class, (short) value);
742
+ }
743
+ @JRubyMethod
744
+ public Int32 to_int32() {
745
+ Ruby runtime = getRuntime();
746
+ return new Int32(PrimitiveService.Int32Class, (int) value);
747
+ }
748
+ @JRubyMethod
749
+ public Int64 to_int64() {
750
+ Ruby runtime = getRuntime();
751
+ return new Int64(PrimitiveService.Int64Class, (long) value);
752
+ }
753
+ @JRubyMethod
754
+ public Float32 to_float32() {
755
+ Ruby runtime = getRuntime();
756
+ return new Float32(PrimitiveService.Float32Class, (float) value);
757
+ }
758
+ @JRubyMethod
759
+ public Float64 to_float64() {
760
+ Ruby runtime = getRuntime();
761
+ return new Float64(PrimitiveService.Float64Class, (double) value);
762
+ }
763
+ @JRubyMethod
764
+ public RubyInteger as_i() {
765
+ Ruby runtime = getRuntime();
766
+ return PrimitiveService.__int32_to_i(runtime, value);
767
+ }
768
+ @JRubyMethod
769
+ public RubyFloat as_f() {
770
+ Ruby runtime = getRuntime();
771
+ return PrimitiveService.__int32_to_f(runtime, value);
772
+ }
773
+ @JRubyMethod
774
+ public RubyInteger to_i() {
775
+ Ruby runtime = getRuntime();
776
+ return PrimitiveService.__int32_to_i(runtime, value);
777
+ }
778
+ @JRubyMethod
779
+ public RubyInteger to_int() {
780
+ Ruby runtime = getRuntime();
781
+ return PrimitiveService.__int32_to_i(runtime, value);
782
+ }
783
+ @JRubyMethod
784
+ public RubyFloat to_f() {
785
+ Ruby runtime = getRuntime();
786
+ return PrimitiveService.__int32_to_f(runtime, value);
787
+ }
788
+ @JRubyMethod
789
+ public RubyString to_s() {
790
+ Ruby runtime = getRuntime();
791
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
792
+ }
793
+ @JRubyMethod
794
+ public RubyString inspect() {
795
+ Ruby runtime = getRuntime();
796
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
797
+ }
798
+ @JRubyMethod(name = "==")
799
+ public RubyBoolean eq(IRubyObject o) {
800
+ Ruby runtime = getRuntime();
801
+ int v = PrimitiveService.__object_i32(runtime, o);
802
+ return RubyBoolean.newBoolean(runtime, value == v);
803
+ }
804
+ @JRubyMethod(name = "!=")
805
+ public RubyBoolean ne(IRubyObject o) {
806
+ Ruby runtime = getRuntime();
807
+ int v = PrimitiveService.__object_i32(runtime, o);
808
+ return RubyBoolean.newBoolean(runtime, value != v);
809
+ }
810
+ @JRubyMethod(name = "+@")
811
+ public Int32 pos() {
812
+ Ruby runtime = getRuntime();
813
+ return new Int32(PrimitiveService.Int32Class, +value);
814
+ }
815
+ @JRubyMethod(name = "-@")
816
+ public Int32 neg() {
817
+ Ruby runtime = getRuntime();
818
+ return new Int32(PrimitiveService.Int32Class, -value);
819
+ }
820
+ @JRubyMethod(name = "*")
821
+ public Int32 mul(IRubyObject o) {
822
+ Ruby runtime = getRuntime();
823
+ int v = PrimitiveService.__object_i32(runtime, o);
824
+ return new Int32(PrimitiveService.Int32Class, value * v);
825
+ }
826
+ @JRubyMethod(name = "/")
827
+ public Int32 div(IRubyObject o) {
828
+ Ruby runtime = getRuntime();
829
+ int v = PrimitiveService.__object_i32(runtime, o);
830
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_div(runtime, value, v));
831
+ }
832
+ @JRubyMethod(name = "%")
833
+ public Int32 mod(IRubyObject o) {
834
+ Ruby runtime = getRuntime();
835
+ int v = PrimitiveService.__object_i32(runtime, o);
836
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_mod(runtime, value, v));
837
+ }
838
+ @JRubyMethod(name = "+")
839
+ public Int32 add(IRubyObject o) {
840
+ Ruby runtime = getRuntime();
841
+ int v = PrimitiveService.__object_i32(runtime, o);
842
+ return new Int32(PrimitiveService.Int32Class, value + v);
843
+ }
844
+ @JRubyMethod(name = "-")
845
+ public Int32 sub(IRubyObject o) {
846
+ Ruby runtime = getRuntime();
847
+ int v = PrimitiveService.__object_i32(runtime, o);
848
+ return new Int32(PrimitiveService.Int32Class, value - v);
849
+ }
850
+ @JRubyMethod(name = "<=>")
851
+ public Int32 cmp(IRubyObject o) {
852
+ Ruby runtime = getRuntime();
853
+ int value = this.value;
854
+ int v = PrimitiveService.__object_i32(runtime, o);
855
+ if (value < v)
856
+ return PrimitiveService.Int32_M1;
857
+ if (value > v)
858
+ return PrimitiveService.Int32_1;
859
+ return PrimitiveService.Int32_0;
860
+ }
861
+ @JRubyMethod(name = "<")
862
+ public RubyBoolean lt(IRubyObject o) {
863
+ Ruby runtime = getRuntime();
864
+ int v = PrimitiveService.__object_i32(runtime, o);
865
+ return RubyBoolean.newBoolean(runtime, value < v);
866
+ }
867
+ @JRubyMethod(name = "<=")
868
+ public RubyBoolean le(IRubyObject o) {
869
+ Ruby runtime = getRuntime();
870
+ int v = PrimitiveService.__object_i32(runtime, o);
871
+ return RubyBoolean.newBoolean(runtime, value <= v);
872
+ }
873
+ @JRubyMethod(name = ">=")
874
+ public RubyBoolean ge(IRubyObject o) {
875
+ Ruby runtime = getRuntime();
876
+ int v = PrimitiveService.__object_i32(runtime, o);
877
+ return RubyBoolean.newBoolean(runtime, value >= v);
878
+ }
879
+ @JRubyMethod(name = ">")
880
+ public RubyBoolean gt(IRubyObject o) {
881
+ Ruby runtime = getRuntime();
882
+ int v = PrimitiveService.__object_i32(runtime, o);
883
+ return RubyBoolean.newBoolean(runtime, value > v);
884
+ }
885
+ @JRubyMethod(name = "~")
886
+ public Int32 inv() {
887
+ Ruby runtime = getRuntime();
888
+ return new Int32(PrimitiveService.Int32Class, ~value);
889
+ }
890
+ @JRubyMethod(name = "<<")
891
+ public Int32 shl(IRubyObject o) {
892
+ Ruby runtime = getRuntime();
893
+ int v = PrimitiveService.__object_i32(runtime, o);
894
+ return new Int32(PrimitiveService.Int32Class, value << v);
895
+ }
896
+ @JRubyMethod(name = ">>")
897
+ public Int32 shr(IRubyObject o) {
898
+ Ruby runtime = getRuntime();
899
+ int v = PrimitiveService.__object_i32(runtime, o);
900
+ return new Int32(PrimitiveService.Int32Class, value >> v);
901
+ }
902
+ @JRubyMethod(name = "ushr")
903
+ public Int32 ushr(IRubyObject o) {
904
+ Ruby runtime = getRuntime();
905
+ int v = PrimitiveService.__object_i32(runtime, o);
906
+ return new Int32(PrimitiveService.Int32Class, value >>> v);
907
+ }
908
+ @JRubyMethod(name = "&")
909
+ public Int32 and(IRubyObject o) {
910
+ Ruby runtime = getRuntime();
911
+ int v = PrimitiveService.__object_i32(runtime, o);
912
+ return new Int32(PrimitiveService.Int32Class, value & v);
913
+ }
914
+ @JRubyMethod(name = "^")
915
+ public Int32 xor(IRubyObject o) {
916
+ Ruby runtime = getRuntime();
917
+ int v = PrimitiveService.__object_i32(runtime, o);
918
+ return new Int32(PrimitiveService.Int32Class, value ^ v);
919
+ }
920
+ @JRubyMethod(name = "|")
921
+ public Int32 or(IRubyObject o) {
922
+ Ruby runtime = getRuntime();
923
+ int v = PrimitiveService.__object_i32(runtime, o);
924
+ return new Int32(PrimitiveService.Int32Class, value | v);
925
+ }
926
+ @JRubyMethod(name = "zero?")
927
+ public RubyBoolean is_zero() {
928
+ Ruby runtime = getRuntime();
929
+ return RubyBoolean.newBoolean(runtime, value == 0);
930
+ }
931
+ }
932
+ public static class Int32 extends RubyObject {
933
+ @JRubyMethod(name = "[]", meta = true)
934
+ public static Int32 get(IRubyObject self, IRubyObject o) {
935
+ RubyClass klass = (RubyClass) self;
936
+ Ruby runtime = klass.getRuntime();
937
+ int v = PrimitiveService.__object_i32(runtime, o);
938
+ return new Int32(klass, v);
939
+ }
940
+ final int value;
941
+ public Int32(RubyClass klass, int value) {
942
+ super(klass);
943
+ this.value = (int) value;
944
+ return;
945
+ }
946
+ @Override
947
+ public java.lang.Object toJava(java.lang.Class target) {
948
+ return value;
949
+ }
950
+ @JRubyMethod(name = "eql?")
951
+ public RubyBoolean is_eql(IRubyObject o) {
952
+ Ruby runtime = getRuntime();
953
+ if (o instanceof Int32) {
954
+ int v = ((Int32) o).value;
955
+ return RubyBoolean.newBoolean(runtime, value == v);
956
+ }
957
+ return RubyBoolean.newBoolean(runtime, false);
958
+ }
959
+ @JRubyMethod
960
+ public RubyFixnum hash() {
961
+ Ruby runtime = getRuntime();
962
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__int32_hash(value));
963
+ }
964
+ @JRubyMethod
965
+ public Byte to_byte() {
966
+ Ruby runtime = getRuntime();
967
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
968
+ }
969
+ @JRubyMethod
970
+ public Char to_char() {
971
+ Ruby runtime = getRuntime();
972
+ return new Char(PrimitiveService.CharClass, (char) value);
973
+ }
974
+ @JRubyMethod
975
+ public Int16 to_int16() {
976
+ Ruby runtime = getRuntime();
977
+ return new Int16(PrimitiveService.Int16Class, (short) value);
978
+ }
979
+ @JRubyMethod
980
+ public Int32 to_int32() {
981
+ Ruby runtime = getRuntime();
982
+ return new Int32(PrimitiveService.Int32Class, (int) value);
983
+ }
984
+ @JRubyMethod
985
+ public Int64 to_int64() {
986
+ Ruby runtime = getRuntime();
987
+ return new Int64(PrimitiveService.Int64Class, (long) value);
988
+ }
989
+ @JRubyMethod
990
+ public Float32 to_float32() {
991
+ Ruby runtime = getRuntime();
992
+ return new Float32(PrimitiveService.Float32Class, (float) value);
993
+ }
994
+ @JRubyMethod
995
+ public Float64 to_float64() {
996
+ Ruby runtime = getRuntime();
997
+ return new Float64(PrimitiveService.Float64Class, (double) value);
998
+ }
999
+ @JRubyMethod
1000
+ public RubyInteger as_i() {
1001
+ Ruby runtime = getRuntime();
1002
+ return PrimitiveService.__int32_to_i(runtime, value);
1003
+ }
1004
+ @JRubyMethod
1005
+ public RubyFloat as_f() {
1006
+ Ruby runtime = getRuntime();
1007
+ return PrimitiveService.__int32_to_f(runtime, value);
1008
+ }
1009
+ @JRubyMethod
1010
+ public RubyInteger to_i() {
1011
+ Ruby runtime = getRuntime();
1012
+ return PrimitiveService.__int32_to_i(runtime, value);
1013
+ }
1014
+ @JRubyMethod
1015
+ public RubyInteger to_int() {
1016
+ Ruby runtime = getRuntime();
1017
+ return PrimitiveService.__int32_to_i(runtime, value);
1018
+ }
1019
+ @JRubyMethod
1020
+ public RubyFloat to_f() {
1021
+ Ruby runtime = getRuntime();
1022
+ return PrimitiveService.__int32_to_f(runtime, value);
1023
+ }
1024
+ @JRubyMethod
1025
+ public RubyString to_s() {
1026
+ Ruby runtime = getRuntime();
1027
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
1028
+ }
1029
+ @JRubyMethod
1030
+ public RubyString inspect() {
1031
+ Ruby runtime = getRuntime();
1032
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_s(runtime, value));
1033
+ }
1034
+ @JRubyMethod(name = "==")
1035
+ public RubyBoolean eq(IRubyObject o) {
1036
+ Ruby runtime = getRuntime();
1037
+ int v = PrimitiveService.__object_i32(runtime, o);
1038
+ return RubyBoolean.newBoolean(runtime, value == v);
1039
+ }
1040
+ @JRubyMethod(name = "!=")
1041
+ public RubyBoolean ne(IRubyObject o) {
1042
+ Ruby runtime = getRuntime();
1043
+ int v = PrimitiveService.__object_i32(runtime, o);
1044
+ return RubyBoolean.newBoolean(runtime, value != v);
1045
+ }
1046
+ @JRubyMethod(name = "+@")
1047
+ public Int32 pos() {
1048
+ Ruby runtime = getRuntime();
1049
+ return new Int32(PrimitiveService.Int32Class, +value);
1050
+ }
1051
+ @JRubyMethod(name = "-@")
1052
+ public Int32 neg() {
1053
+ Ruby runtime = getRuntime();
1054
+ return new Int32(PrimitiveService.Int32Class, -value);
1055
+ }
1056
+ @JRubyMethod(name = "*")
1057
+ public Int32 mul(IRubyObject o) {
1058
+ Ruby runtime = getRuntime();
1059
+ int v = PrimitiveService.__object_i32(runtime, o);
1060
+ return new Int32(PrimitiveService.Int32Class, value * v);
1061
+ }
1062
+ @JRubyMethod(name = "/")
1063
+ public Int32 div(IRubyObject o) {
1064
+ Ruby runtime = getRuntime();
1065
+ int v = PrimitiveService.__object_i32(runtime, o);
1066
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_div(runtime, value, v));
1067
+ }
1068
+ @JRubyMethod(name = "%")
1069
+ public Int32 mod(IRubyObject o) {
1070
+ Ruby runtime = getRuntime();
1071
+ int v = PrimitiveService.__object_i32(runtime, o);
1072
+ return new Int32(PrimitiveService.Int32Class, PrimitiveService.__int32_mod(runtime, value, v));
1073
+ }
1074
+ @JRubyMethod(name = "+")
1075
+ public Int32 add(IRubyObject o) {
1076
+ Ruby runtime = getRuntime();
1077
+ int v = PrimitiveService.__object_i32(runtime, o);
1078
+ return new Int32(PrimitiveService.Int32Class, value + v);
1079
+ }
1080
+ @JRubyMethod(name = "-")
1081
+ public Int32 sub(IRubyObject o) {
1082
+ Ruby runtime = getRuntime();
1083
+ int v = PrimitiveService.__object_i32(runtime, o);
1084
+ return new Int32(PrimitiveService.Int32Class, value - v);
1085
+ }
1086
+ @JRubyMethod(name = "<=>")
1087
+ public Int32 cmp(IRubyObject o) {
1088
+ Ruby runtime = getRuntime();
1089
+ int value = this.value;
1090
+ int v = PrimitiveService.__object_i32(runtime, o);
1091
+ if (value < v)
1092
+ return PrimitiveService.Int32_M1;
1093
+ if (value > v)
1094
+ return PrimitiveService.Int32_1;
1095
+ return PrimitiveService.Int32_0;
1096
+ }
1097
+ @JRubyMethod(name = "<")
1098
+ public RubyBoolean lt(IRubyObject o) {
1099
+ Ruby runtime = getRuntime();
1100
+ int v = PrimitiveService.__object_i32(runtime, o);
1101
+ return RubyBoolean.newBoolean(runtime, value < v);
1102
+ }
1103
+ @JRubyMethod(name = "<=")
1104
+ public RubyBoolean le(IRubyObject o) {
1105
+ Ruby runtime = getRuntime();
1106
+ int v = PrimitiveService.__object_i32(runtime, o);
1107
+ return RubyBoolean.newBoolean(runtime, value <= v);
1108
+ }
1109
+ @JRubyMethod(name = ">=")
1110
+ public RubyBoolean ge(IRubyObject o) {
1111
+ Ruby runtime = getRuntime();
1112
+ int v = PrimitiveService.__object_i32(runtime, o);
1113
+ return RubyBoolean.newBoolean(runtime, value >= v);
1114
+ }
1115
+ @JRubyMethod(name = ">")
1116
+ public RubyBoolean gt(IRubyObject o) {
1117
+ Ruby runtime = getRuntime();
1118
+ int v = PrimitiveService.__object_i32(runtime, o);
1119
+ return RubyBoolean.newBoolean(runtime, value > v);
1120
+ }
1121
+ @JRubyMethod(name = "~")
1122
+ public Int32 inv() {
1123
+ Ruby runtime = getRuntime();
1124
+ return new Int32(PrimitiveService.Int32Class, ~value);
1125
+ }
1126
+ @JRubyMethod(name = "<<")
1127
+ public Int32 shl(IRubyObject o) {
1128
+ Ruby runtime = getRuntime();
1129
+ int v = PrimitiveService.__object_i32(runtime, o);
1130
+ return new Int32(PrimitiveService.Int32Class, value << v);
1131
+ }
1132
+ @JRubyMethod(name = ">>")
1133
+ public Int32 shr(IRubyObject o) {
1134
+ Ruby runtime = getRuntime();
1135
+ int v = PrimitiveService.__object_i32(runtime, o);
1136
+ return new Int32(PrimitiveService.Int32Class, value >> v);
1137
+ }
1138
+ @JRubyMethod(name = "ushr")
1139
+ public Int32 ushr(IRubyObject o) {
1140
+ Ruby runtime = getRuntime();
1141
+ int v = PrimitiveService.__object_i32(runtime, o);
1142
+ return new Int32(PrimitiveService.Int32Class, value >>> v);
1143
+ }
1144
+ @JRubyMethod(name = "&")
1145
+ public Int32 and(IRubyObject o) {
1146
+ Ruby runtime = getRuntime();
1147
+ int v = PrimitiveService.__object_i32(runtime, o);
1148
+ return new Int32(PrimitiveService.Int32Class, value & v);
1149
+ }
1150
+ @JRubyMethod(name = "^")
1151
+ public Int32 xor(IRubyObject o) {
1152
+ Ruby runtime = getRuntime();
1153
+ int v = PrimitiveService.__object_i32(runtime, o);
1154
+ return new Int32(PrimitiveService.Int32Class, value ^ v);
1155
+ }
1156
+ @JRubyMethod(name = "|")
1157
+ public Int32 or(IRubyObject o) {
1158
+ Ruby runtime = getRuntime();
1159
+ int v = PrimitiveService.__object_i32(runtime, o);
1160
+ return new Int32(PrimitiveService.Int32Class, value | v);
1161
+ }
1162
+ @JRubyMethod(name = "zero?")
1163
+ public RubyBoolean is_zero() {
1164
+ Ruby runtime = getRuntime();
1165
+ return RubyBoolean.newBoolean(runtime, value == 0);
1166
+ }
1167
+ @JRubyMethod(name = "to_int32!")
1168
+ public Int32 bang_to_int32() {
1169
+ Ruby runtime = getRuntime();
1170
+ return new Int32(PrimitiveService.Int32Class, (int) value);
1171
+ }
1172
+ @JRubyMethod(name = "to_int64!")
1173
+ public Int64 bang_to_int64() {
1174
+ Ruby runtime = getRuntime();
1175
+ return new Int64(PrimitiveService.Int64Class, (long) value);
1176
+ }
1177
+ @JRubyMethod
1178
+ public RubyFixnum to_fixnum() {
1179
+ Ruby runtime = getRuntime();
1180
+ return RubyFixnum.newFixnum(runtime, (long) value);
1181
+ }
1182
+ @JRubyMethod
1183
+ public RubyFixnum new_fixnum() {
1184
+ Ruby runtime = getRuntime();
1185
+ return RubyFixnum.newFixnum(runtime, (long) value);
1186
+ }
1187
+ @JRubyMethod
1188
+ public RubyString to_hex() {
1189
+ Ruby runtime = getRuntime();
1190
+ return RubyString.newString(runtime, PrimitiveService.__int32_to_hex(runtime, value));
1191
+ }
1192
+ @JRubyMethod
1193
+ public RubyString chr() {
1194
+ Ruby runtime = getRuntime();
1195
+ return RubyString.newString(runtime, PrimitiveService.__int32_chr(runtime, value));
1196
+ }
1197
+ @JRubyMethod
1198
+ public Int32 rol(IRubyObject o) {
1199
+ Ruby runtime = getRuntime();
1200
+ int v = PrimitiveService.__object_i32(runtime, o);
1201
+ return new Int32(PrimitiveService.Int32Class, java.lang.Integer.rotateLeft(value, v));
1202
+ }
1203
+ @JRubyMethod
1204
+ public Int32 ror(IRubyObject o) {
1205
+ Ruby runtime = getRuntime();
1206
+ int v = PrimitiveService.__object_i32(runtime, o);
1207
+ return new Int32(PrimitiveService.Int32Class, java.lang.Integer.rotateRight(value, v));
1208
+ }
1209
+ @JRubyMethod
1210
+ public Int32 count() {
1211
+ Ruby runtime = getRuntime();
1212
+ return new Int32(PrimitiveService.Int32Class, java.lang.Integer.bitCount(value));
1213
+ }
1214
+ @JRubyMethod
1215
+ public Int32 signum() {
1216
+ Ruby runtime = getRuntime();
1217
+ int value = this.value;
1218
+ if (value < 0)
1219
+ return PrimitiveService.Int32_M1;
1220
+ if (value > 0)
1221
+ return PrimitiveService.Int32_1;
1222
+ return PrimitiveService.Int32_0;
1223
+ }
1224
+ @JRubyMethod
1225
+ public IRubyObject times(Block block) {
1226
+ Ruby runtime = getRuntime();
1227
+ RubyClass klass = PrimitiveService.Int32Class;
1228
+ ThreadContext context = runtime.getCurrentContext();
1229
+ int value = this.value;
1230
+ int i = 0;
1231
+ while (i < value) {
1232
+ block.call(context, new Int32(klass, i));
1233
+ i += 1;
1234
+ }
1235
+ return runtime.getNil();
1236
+ }
1237
+ @JRubyMethod
1238
+ public IRubyObject upto(IRubyObject o, Block block) {
1239
+ Ruby runtime = getRuntime();
1240
+ RubyClass klass = PrimitiveService.Int32Class;
1241
+ ThreadContext context = runtime.getCurrentContext();
1242
+ int i = this.value;
1243
+ int v = (int) PrimitiveService.__object_i32(runtime, o);
1244
+ if (i <= v) {
1245
+ while (true) {
1246
+ block.call(context, new Int32(klass, i));
1247
+ if (i == v)
1248
+ break;
1249
+ i += 1;
1250
+ }
1251
+ }
1252
+ return runtime.getNil();
1253
+ }
1254
+ @JRubyMethod
1255
+ public IRubyObject downto(IRubyObject o, Block block) {
1256
+ Ruby runtime = getRuntime();
1257
+ RubyClass klass = PrimitiveService.Int32Class;
1258
+ ThreadContext context = runtime.getCurrentContext();
1259
+ int i = this.value;
1260
+ int v = (int) PrimitiveService.__object_i32(runtime, o);
1261
+ if (i >= v) {
1262
+ while (true) {
1263
+ block.call(context, new Int32(klass, i));
1264
+ if (i == v)
1265
+ break;
1266
+ i -= 1;
1267
+ }
1268
+ }
1269
+ return runtime.getNil();
1270
+ }
1271
+ }
1272
+ public static class Int64 extends RubyObject {
1273
+ @JRubyMethod(name = "[]", meta = true)
1274
+ public static Int64 get(IRubyObject self, IRubyObject o) {
1275
+ RubyClass klass = (RubyClass) self;
1276
+ Ruby runtime = klass.getRuntime();
1277
+ long v = PrimitiveService.__object_i64(runtime, o);
1278
+ return new Int64(klass, v);
1279
+ }
1280
+ final long value;
1281
+ public Int64(RubyClass klass, long value) {
1282
+ super(klass);
1283
+ this.value = (long) value;
1284
+ return;
1285
+ }
1286
+ @Override
1287
+ public java.lang.Object toJava(java.lang.Class target) {
1288
+ return value;
1289
+ }
1290
+ @JRubyMethod(name = "eql?")
1291
+ public RubyBoolean is_eql(IRubyObject o) {
1292
+ Ruby runtime = getRuntime();
1293
+ if (o instanceof Int64) {
1294
+ long v = ((Int64) o).value;
1295
+ return RubyBoolean.newBoolean(runtime, value == v);
1296
+ }
1297
+ return RubyBoolean.newBoolean(runtime, false);
1298
+ }
1299
+ @JRubyMethod
1300
+ public RubyFixnum hash() {
1301
+ Ruby runtime = getRuntime();
1302
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__int64_hash(value));
1303
+ }
1304
+ @JRubyMethod
1305
+ public Byte to_byte() {
1306
+ Ruby runtime = getRuntime();
1307
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
1308
+ }
1309
+ @JRubyMethod
1310
+ public Char to_char() {
1311
+ Ruby runtime = getRuntime();
1312
+ return new Char(PrimitiveService.CharClass, (char) value);
1313
+ }
1314
+ @JRubyMethod
1315
+ public Int16 to_int16() {
1316
+ Ruby runtime = getRuntime();
1317
+ return new Int16(PrimitiveService.Int16Class, (short) value);
1318
+ }
1319
+ @JRubyMethod
1320
+ public Int32 to_int32() {
1321
+ Ruby runtime = getRuntime();
1322
+ return new Int32(PrimitiveService.Int32Class, (int) value);
1323
+ }
1324
+ @JRubyMethod
1325
+ public Int64 to_int64() {
1326
+ Ruby runtime = getRuntime();
1327
+ return new Int64(PrimitiveService.Int64Class, (long) value);
1328
+ }
1329
+ @JRubyMethod
1330
+ public Float32 to_float32() {
1331
+ Ruby runtime = getRuntime();
1332
+ return new Float32(PrimitiveService.Float32Class, (float) value);
1333
+ }
1334
+ @JRubyMethod
1335
+ public Float64 to_float64() {
1336
+ Ruby runtime = getRuntime();
1337
+ return new Float64(PrimitiveService.Float64Class, (double) value);
1338
+ }
1339
+ @JRubyMethod
1340
+ public RubyInteger as_i() {
1341
+ Ruby runtime = getRuntime();
1342
+ return PrimitiveService.__int64_to_i(runtime, value);
1343
+ }
1344
+ @JRubyMethod
1345
+ public RubyFloat as_f() {
1346
+ Ruby runtime = getRuntime();
1347
+ return PrimitiveService.__int64_to_f(runtime, value);
1348
+ }
1349
+ @JRubyMethod
1350
+ public RubyInteger to_i() {
1351
+ Ruby runtime = getRuntime();
1352
+ return PrimitiveService.__int64_to_i(runtime, value);
1353
+ }
1354
+ @JRubyMethod
1355
+ public RubyInteger to_int() {
1356
+ Ruby runtime = getRuntime();
1357
+ return PrimitiveService.__int64_to_i(runtime, value);
1358
+ }
1359
+ @JRubyMethod
1360
+ public RubyFloat to_f() {
1361
+ Ruby runtime = getRuntime();
1362
+ return PrimitiveService.__int64_to_f(runtime, value);
1363
+ }
1364
+ @JRubyMethod
1365
+ public RubyString to_s() {
1366
+ Ruby runtime = getRuntime();
1367
+ return RubyString.newString(runtime, PrimitiveService.__int64_to_s(runtime, value));
1368
+ }
1369
+ @JRubyMethod
1370
+ public RubyString inspect() {
1371
+ Ruby runtime = getRuntime();
1372
+ return RubyString.newString(runtime, PrimitiveService.__int64_to_s(runtime, value));
1373
+ }
1374
+ @JRubyMethod(name = "==")
1375
+ public RubyBoolean eq(IRubyObject o) {
1376
+ Ruby runtime = getRuntime();
1377
+ long v = PrimitiveService.__object_i64(runtime, o);
1378
+ return RubyBoolean.newBoolean(runtime, value == v);
1379
+ }
1380
+ @JRubyMethod(name = "!=")
1381
+ public RubyBoolean ne(IRubyObject o) {
1382
+ Ruby runtime = getRuntime();
1383
+ long v = PrimitiveService.__object_i64(runtime, o);
1384
+ return RubyBoolean.newBoolean(runtime, value != v);
1385
+ }
1386
+ @JRubyMethod(name = "+@")
1387
+ public Int64 pos() {
1388
+ Ruby runtime = getRuntime();
1389
+ return new Int64(PrimitiveService.Int64Class, +value);
1390
+ }
1391
+ @JRubyMethod(name = "-@")
1392
+ public Int64 neg() {
1393
+ Ruby runtime = getRuntime();
1394
+ return new Int64(PrimitiveService.Int64Class, -value);
1395
+ }
1396
+ @JRubyMethod(name = "*")
1397
+ public Int64 mul(IRubyObject o) {
1398
+ Ruby runtime = getRuntime();
1399
+ long v = PrimitiveService.__object_i64(runtime, o);
1400
+ return new Int64(PrimitiveService.Int64Class, value * v);
1401
+ }
1402
+ @JRubyMethod(name = "/")
1403
+ public Int64 div(IRubyObject o) {
1404
+ Ruby runtime = getRuntime();
1405
+ long v = PrimitiveService.__object_i64(runtime, o);
1406
+ return new Int64(PrimitiveService.Int64Class, PrimitiveService.__int64_div(runtime, value, v));
1407
+ }
1408
+ @JRubyMethod(name = "%")
1409
+ public Int64 mod(IRubyObject o) {
1410
+ Ruby runtime = getRuntime();
1411
+ long v = PrimitiveService.__object_i64(runtime, o);
1412
+ return new Int64(PrimitiveService.Int64Class, PrimitiveService.__int64_mod(runtime, value, v));
1413
+ }
1414
+ @JRubyMethod(name = "+")
1415
+ public Int64 add(IRubyObject o) {
1416
+ Ruby runtime = getRuntime();
1417
+ long v = PrimitiveService.__object_i64(runtime, o);
1418
+ return new Int64(PrimitiveService.Int64Class, value + v);
1419
+ }
1420
+ @JRubyMethod(name = "-")
1421
+ public Int64 sub(IRubyObject o) {
1422
+ Ruby runtime = getRuntime();
1423
+ long v = PrimitiveService.__object_i64(runtime, o);
1424
+ return new Int64(PrimitiveService.Int64Class, value - v);
1425
+ }
1426
+ @JRubyMethod(name = "<=>")
1427
+ public Int32 cmp(IRubyObject o) {
1428
+ Ruby runtime = getRuntime();
1429
+ long value = this.value;
1430
+ long v = PrimitiveService.__object_i64(runtime, o);
1431
+ if (value < v)
1432
+ return PrimitiveService.Int32_M1;
1433
+ if (value > v)
1434
+ return PrimitiveService.Int32_1;
1435
+ return PrimitiveService.Int32_0;
1436
+ }
1437
+ @JRubyMethod(name = "<")
1438
+ public RubyBoolean lt(IRubyObject o) {
1439
+ Ruby runtime = getRuntime();
1440
+ long v = PrimitiveService.__object_i64(runtime, o);
1441
+ return RubyBoolean.newBoolean(runtime, value < v);
1442
+ }
1443
+ @JRubyMethod(name = "<=")
1444
+ public RubyBoolean le(IRubyObject o) {
1445
+ Ruby runtime = getRuntime();
1446
+ long v = PrimitiveService.__object_i64(runtime, o);
1447
+ return RubyBoolean.newBoolean(runtime, value <= v);
1448
+ }
1449
+ @JRubyMethod(name = ">=")
1450
+ public RubyBoolean ge(IRubyObject o) {
1451
+ Ruby runtime = getRuntime();
1452
+ long v = PrimitiveService.__object_i64(runtime, o);
1453
+ return RubyBoolean.newBoolean(runtime, value >= v);
1454
+ }
1455
+ @JRubyMethod(name = ">")
1456
+ public RubyBoolean gt(IRubyObject o) {
1457
+ Ruby runtime = getRuntime();
1458
+ long v = PrimitiveService.__object_i64(runtime, o);
1459
+ return RubyBoolean.newBoolean(runtime, value > v);
1460
+ }
1461
+ @JRubyMethod(name = "~")
1462
+ public Int64 inv() {
1463
+ Ruby runtime = getRuntime();
1464
+ return new Int64(PrimitiveService.Int64Class, ~value);
1465
+ }
1466
+ @JRubyMethod(name = "<<")
1467
+ public Int64 shl(IRubyObject o) {
1468
+ Ruby runtime = getRuntime();
1469
+ int v = PrimitiveService.__object_i32(runtime, o);
1470
+ return new Int64(PrimitiveService.Int64Class, value << v);
1471
+ }
1472
+ @JRubyMethod(name = ">>")
1473
+ public Int64 shr(IRubyObject o) {
1474
+ Ruby runtime = getRuntime();
1475
+ int v = PrimitiveService.__object_i32(runtime, o);
1476
+ return new Int64(PrimitiveService.Int64Class, value >> v);
1477
+ }
1478
+ @JRubyMethod(name = "ushr")
1479
+ public Int64 ushr(IRubyObject o) {
1480
+ Ruby runtime = getRuntime();
1481
+ int v = PrimitiveService.__object_i32(runtime, o);
1482
+ return new Int64(PrimitiveService.Int64Class, value >>> v);
1483
+ }
1484
+ @JRubyMethod(name = "&")
1485
+ public Int64 and(IRubyObject o) {
1486
+ Ruby runtime = getRuntime();
1487
+ long v = PrimitiveService.__object_i64(runtime, o);
1488
+ return new Int64(PrimitiveService.Int64Class, value & v);
1489
+ }
1490
+ @JRubyMethod(name = "^")
1491
+ public Int64 xor(IRubyObject o) {
1492
+ Ruby runtime = getRuntime();
1493
+ long v = PrimitiveService.__object_i64(runtime, o);
1494
+ return new Int64(PrimitiveService.Int64Class, value ^ v);
1495
+ }
1496
+ @JRubyMethod(name = "|")
1497
+ public Int64 or(IRubyObject o) {
1498
+ Ruby runtime = getRuntime();
1499
+ long v = PrimitiveService.__object_i64(runtime, o);
1500
+ return new Int64(PrimitiveService.Int64Class, value | v);
1501
+ }
1502
+ @JRubyMethod(name = "zero?")
1503
+ public RubyBoolean is_zero() {
1504
+ Ruby runtime = getRuntime();
1505
+ return RubyBoolean.newBoolean(runtime, value == 0);
1506
+ }
1507
+ @JRubyMethod(name = "to_int32!")
1508
+ public Int32 bang_to_int32() {
1509
+ Ruby runtime = getRuntime();
1510
+ if (value < -0x80000000 || value > 0x7FFFFFFF)
1511
+ throw runtime.newRangeError("int64 too big to convert to int32");
1512
+ return new Int32(PrimitiveService.Int32Class, (int) value);
1513
+ }
1514
+ @JRubyMethod(name = "to_int64!")
1515
+ public Int64 bang_to_int64() {
1516
+ Ruby runtime = getRuntime();
1517
+ return new Int64(PrimitiveService.Int64Class, (long) value);
1518
+ }
1519
+ @JRubyMethod
1520
+ public RubyFixnum to_fixnum() {
1521
+ Ruby runtime = getRuntime();
1522
+ return RubyFixnum.newFixnum(runtime, (long) value);
1523
+ }
1524
+ @JRubyMethod
1525
+ public RubyFixnum new_fixnum() {
1526
+ Ruby runtime = getRuntime();
1527
+ return RubyFixnum.newFixnum(runtime, (long) value);
1528
+ }
1529
+ @JRubyMethod
1530
+ public RubyString to_hex() {
1531
+ Ruby runtime = getRuntime();
1532
+ return RubyString.newString(runtime, PrimitiveService.__int64_to_hex(runtime, value));
1533
+ }
1534
+ @JRubyMethod
1535
+ public Int64 rol(IRubyObject o) {
1536
+ Ruby runtime = getRuntime();
1537
+ int v = PrimitiveService.__object_i32(runtime, o);
1538
+ return new Int64(PrimitiveService.Int64Class, java.lang.Long.rotateLeft(value, v));
1539
+ }
1540
+ @JRubyMethod
1541
+ public Int64 ror(IRubyObject o) {
1542
+ Ruby runtime = getRuntime();
1543
+ int v = PrimitiveService.__object_i32(runtime, o);
1544
+ return new Int64(PrimitiveService.Int64Class, java.lang.Long.rotateRight(value, v));
1545
+ }
1546
+ @JRubyMethod
1547
+ public Int32 count() {
1548
+ Ruby runtime = getRuntime();
1549
+ return new Int32(PrimitiveService.Int32Class, java.lang.Long.bitCount(value));
1550
+ }
1551
+ @JRubyMethod
1552
+ public Int32 signum() {
1553
+ Ruby runtime = getRuntime();
1554
+ long value = this.value;
1555
+ if (value < 0)
1556
+ return PrimitiveService.Int32_M1;
1557
+ if (value > 0)
1558
+ return PrimitiveService.Int32_1;
1559
+ return PrimitiveService.Int32_0;
1560
+ }
1561
+ @JRubyMethod
1562
+ public IRubyObject times(Block block) {
1563
+ Ruby runtime = getRuntime();
1564
+ RubyClass klass = PrimitiveService.Int64Class;
1565
+ ThreadContext context = runtime.getCurrentContext();
1566
+ long value = this.value;
1567
+ long i = 0;
1568
+ while (i < value) {
1569
+ block.call(context, new Int64(klass, i));
1570
+ i += 1;
1571
+ }
1572
+ return runtime.getNil();
1573
+ }
1574
+ }
1575
+ public static class Float32 extends RubyObject {
1576
+ @JRubyMethod(name = "[]", meta = true)
1577
+ public static Float32 get(IRubyObject self, IRubyObject o) {
1578
+ RubyClass klass = (RubyClass) self;
1579
+ Ruby runtime = klass.getRuntime();
1580
+ float v = PrimitiveService.__object_f32(runtime, o);
1581
+ return new Float32(klass, v);
1582
+ }
1583
+ final float value;
1584
+ public Float32(RubyClass klass, float value) {
1585
+ super(klass);
1586
+ this.value = (float) value;
1587
+ return;
1588
+ }
1589
+ @Override
1590
+ public java.lang.Object toJava(java.lang.Class target) {
1591
+ return value;
1592
+ }
1593
+ @JRubyMethod(name = "eql?")
1594
+ public RubyBoolean is_eql(IRubyObject o) {
1595
+ Ruby runtime = getRuntime();
1596
+ if (o instanceof Float32) {
1597
+ float v = ((Float32) o).value;
1598
+ return RubyBoolean.newBoolean(runtime, value == v);
1599
+ }
1600
+ return RubyBoolean.newBoolean(runtime, false);
1601
+ }
1602
+ @JRubyMethod
1603
+ public RubyFixnum hash() {
1604
+ Ruby runtime = getRuntime();
1605
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__float32_hash(value));
1606
+ }
1607
+ @JRubyMethod
1608
+ public Byte to_byte() {
1609
+ Ruby runtime = getRuntime();
1610
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
1611
+ }
1612
+ @JRubyMethod
1613
+ public Char to_char() {
1614
+ Ruby runtime = getRuntime();
1615
+ return new Char(PrimitiveService.CharClass, (char) value);
1616
+ }
1617
+ @JRubyMethod
1618
+ public Int16 to_int16() {
1619
+ Ruby runtime = getRuntime();
1620
+ return new Int16(PrimitiveService.Int16Class, (short) value);
1621
+ }
1622
+ @JRubyMethod
1623
+ public Int32 to_int32() {
1624
+ Ruby runtime = getRuntime();
1625
+ return new Int32(PrimitiveService.Int32Class, (int) value);
1626
+ }
1627
+ @JRubyMethod
1628
+ public Int64 to_int64() {
1629
+ Ruby runtime = getRuntime();
1630
+ return new Int64(PrimitiveService.Int64Class, (long) value);
1631
+ }
1632
+ @JRubyMethod
1633
+ public Float32 to_float32() {
1634
+ Ruby runtime = getRuntime();
1635
+ return new Float32(PrimitiveService.Float32Class, (float) value);
1636
+ }
1637
+ @JRubyMethod
1638
+ public Float64 to_float64() {
1639
+ Ruby runtime = getRuntime();
1640
+ return new Float64(PrimitiveService.Float64Class, (double) value);
1641
+ }
1642
+ @JRubyMethod
1643
+ public RubyInteger as_i() {
1644
+ Ruby runtime = getRuntime();
1645
+ return PrimitiveService.__float32_to_i(runtime, value);
1646
+ }
1647
+ @JRubyMethod
1648
+ public RubyFloat as_f() {
1649
+ Ruby runtime = getRuntime();
1650
+ return PrimitiveService.__float32_to_f(runtime, value);
1651
+ }
1652
+ @JRubyMethod
1653
+ public RubyInteger to_i() {
1654
+ Ruby runtime = getRuntime();
1655
+ return PrimitiveService.__float32_to_i(runtime, value);
1656
+ }
1657
+ @JRubyMethod
1658
+ public RubyInteger to_int() {
1659
+ Ruby runtime = getRuntime();
1660
+ return PrimitiveService.__float32_to_i(runtime, value);
1661
+ }
1662
+ @JRubyMethod
1663
+ public RubyFloat to_f() {
1664
+ Ruby runtime = getRuntime();
1665
+ return PrimitiveService.__float32_to_f(runtime, value);
1666
+ }
1667
+ @JRubyMethod
1668
+ public RubyString to_s() {
1669
+ Ruby runtime = getRuntime();
1670
+ return RubyString.newString(runtime, PrimitiveService.__float32_to_s(runtime, value));
1671
+ }
1672
+ @JRubyMethod
1673
+ public RubyString inspect() {
1674
+ Ruby runtime = getRuntime();
1675
+ return RubyString.newString(runtime, PrimitiveService.__float32_to_s(runtime, value));
1676
+ }
1677
+ @JRubyMethod(name = "==")
1678
+ public RubyBoolean eq(IRubyObject o) {
1679
+ Ruby runtime = getRuntime();
1680
+ float v = PrimitiveService.__object_f32(runtime, o);
1681
+ return RubyBoolean.newBoolean(runtime, value == v);
1682
+ }
1683
+ @JRubyMethod(name = "!=")
1684
+ public RubyBoolean ne(IRubyObject o) {
1685
+ Ruby runtime = getRuntime();
1686
+ float v = PrimitiveService.__object_f32(runtime, o);
1687
+ return RubyBoolean.newBoolean(runtime, value != v);
1688
+ }
1689
+ @JRubyMethod(name = "+@")
1690
+ public Float32 pos() {
1691
+ Ruby runtime = getRuntime();
1692
+ return new Float32(PrimitiveService.Float32Class, +value);
1693
+ }
1694
+ @JRubyMethod(name = "-@")
1695
+ public Float32 neg() {
1696
+ Ruby runtime = getRuntime();
1697
+ return new Float32(PrimitiveService.Float32Class, -value);
1698
+ }
1699
+ @JRubyMethod(name = "*")
1700
+ public Float32 mul(IRubyObject o) {
1701
+ Ruby runtime = getRuntime();
1702
+ float v = PrimitiveService.__object_f32(runtime, o);
1703
+ return new Float32(PrimitiveService.Float32Class, value * v);
1704
+ }
1705
+ @JRubyMethod(name = "/")
1706
+ public Float32 div(IRubyObject o) {
1707
+ Ruby runtime = getRuntime();
1708
+ float v = PrimitiveService.__object_f32(runtime, o);
1709
+ return new Float32(PrimitiveService.Float32Class, PrimitiveService.__float32_div(runtime, value, v));
1710
+ }
1711
+ @JRubyMethod(name = "%")
1712
+ public Float32 mod(IRubyObject o) {
1713
+ Ruby runtime = getRuntime();
1714
+ float v = PrimitiveService.__object_f32(runtime, o);
1715
+ return new Float32(PrimitiveService.Float32Class, PrimitiveService.__float32_mod(runtime, value, v));
1716
+ }
1717
+ @JRubyMethod(name = "+")
1718
+ public Float32 add(IRubyObject o) {
1719
+ Ruby runtime = getRuntime();
1720
+ float v = PrimitiveService.__object_f32(runtime, o);
1721
+ return new Float32(PrimitiveService.Float32Class, value + v);
1722
+ }
1723
+ @JRubyMethod(name = "-")
1724
+ public Float32 sub(IRubyObject o) {
1725
+ Ruby runtime = getRuntime();
1726
+ float v = PrimitiveService.__object_f32(runtime, o);
1727
+ return new Float32(PrimitiveService.Float32Class, value - v);
1728
+ }
1729
+ @JRubyMethod(name = "<=>")
1730
+ public Int32 cmp(IRubyObject o) {
1731
+ Ruby runtime = getRuntime();
1732
+ float value = this.value;
1733
+ float v = PrimitiveService.__object_f32(runtime, o);
1734
+ if (value < v)
1735
+ return PrimitiveService.Int32_M1;
1736
+ if (value > v)
1737
+ return PrimitiveService.Int32_1;
1738
+ return PrimitiveService.Int32_0;
1739
+ }
1740
+ @JRubyMethod(name = "<")
1741
+ public RubyBoolean lt(IRubyObject o) {
1742
+ Ruby runtime = getRuntime();
1743
+ float v = PrimitiveService.__object_f32(runtime, o);
1744
+ return RubyBoolean.newBoolean(runtime, value < v);
1745
+ }
1746
+ @JRubyMethod(name = "<=")
1747
+ public RubyBoolean le(IRubyObject o) {
1748
+ Ruby runtime = getRuntime();
1749
+ float v = PrimitiveService.__object_f32(runtime, o);
1750
+ return RubyBoolean.newBoolean(runtime, value <= v);
1751
+ }
1752
+ @JRubyMethod(name = ">=")
1753
+ public RubyBoolean ge(IRubyObject o) {
1754
+ Ruby runtime = getRuntime();
1755
+ float v = PrimitiveService.__object_f32(runtime, o);
1756
+ return RubyBoolean.newBoolean(runtime, value >= v);
1757
+ }
1758
+ @JRubyMethod(name = ">")
1759
+ public RubyBoolean gt(IRubyObject o) {
1760
+ Ruby runtime = getRuntime();
1761
+ float v = PrimitiveService.__object_f32(runtime, o);
1762
+ return RubyBoolean.newBoolean(runtime, value > v);
1763
+ }
1764
+ @JRubyMethod(name = "zero?")
1765
+ public RubyBoolean is_zero() {
1766
+ Ruby runtime = getRuntime();
1767
+ return RubyBoolean.newBoolean(runtime, value == 0);
1768
+ }
1769
+ @JRubyMethod(name = "nan?")
1770
+ public RubyBoolean is_nan() {
1771
+ Ruby runtime = getRuntime();
1772
+ return RubyBoolean.newBoolean(runtime, Float.isNaN(value));
1773
+ }
1774
+ @JRubyMethod(name = "infinite?")
1775
+ public RubyBoolean is_infinite() {
1776
+ Ruby runtime = getRuntime();
1777
+ return RubyBoolean.newBoolean(runtime, Float.isInfinite(value));
1778
+ }
1779
+ @JRubyMethod(name = "finite?")
1780
+ public RubyBoolean is_finite() {
1781
+ Ruby runtime = getRuntime();
1782
+ return RubyBoolean.newBoolean(runtime, !Float.isNaN(value) && !Float.isInfinite(value));
1783
+ }
1784
+ }
1785
+ public static class Float64 extends RubyObject {
1786
+ @JRubyMethod(name = "[]", meta = true)
1787
+ public static Float64 get(IRubyObject self, IRubyObject o) {
1788
+ RubyClass klass = (RubyClass) self;
1789
+ Ruby runtime = klass.getRuntime();
1790
+ double v = PrimitiveService.__object_f64(runtime, o);
1791
+ return new Float64(klass, v);
1792
+ }
1793
+ final double value;
1794
+ public Float64(RubyClass klass, double value) {
1795
+ super(klass);
1796
+ this.value = (double) value;
1797
+ return;
1798
+ }
1799
+ @Override
1800
+ public java.lang.Object toJava(java.lang.Class target) {
1801
+ return value;
1802
+ }
1803
+ @JRubyMethod(name = "eql?")
1804
+ public RubyBoolean is_eql(IRubyObject o) {
1805
+ Ruby runtime = getRuntime();
1806
+ if (o instanceof Float64) {
1807
+ double v = ((Float64) o).value;
1808
+ return RubyBoolean.newBoolean(runtime, value == v);
1809
+ }
1810
+ return RubyBoolean.newBoolean(runtime, false);
1811
+ }
1812
+ @JRubyMethod
1813
+ public RubyFixnum hash() {
1814
+ Ruby runtime = getRuntime();
1815
+ return RubyFixnum.newFixnum(runtime, (long) PrimitiveService.__float64_hash(value));
1816
+ }
1817
+ @JRubyMethod
1818
+ public Byte to_byte() {
1819
+ Ruby runtime = getRuntime();
1820
+ return new Byte(PrimitiveService.ByteClass, (byte) value);
1821
+ }
1822
+ @JRubyMethod
1823
+ public Char to_char() {
1824
+ Ruby runtime = getRuntime();
1825
+ return new Char(PrimitiveService.CharClass, (char) value);
1826
+ }
1827
+ @JRubyMethod
1828
+ public Int16 to_int16() {
1829
+ Ruby runtime = getRuntime();
1830
+ return new Int16(PrimitiveService.Int16Class, (short) value);
1831
+ }
1832
+ @JRubyMethod
1833
+ public Int32 to_int32() {
1834
+ Ruby runtime = getRuntime();
1835
+ return new Int32(PrimitiveService.Int32Class, (int) value);
1836
+ }
1837
+ @JRubyMethod
1838
+ public Int64 to_int64() {
1839
+ Ruby runtime = getRuntime();
1840
+ return new Int64(PrimitiveService.Int64Class, (long) value);
1841
+ }
1842
+ @JRubyMethod
1843
+ public Float32 to_float32() {
1844
+ Ruby runtime = getRuntime();
1845
+ return new Float32(PrimitiveService.Float32Class, (float) value);
1846
+ }
1847
+ @JRubyMethod
1848
+ public Float64 to_float64() {
1849
+ Ruby runtime = getRuntime();
1850
+ return new Float64(PrimitiveService.Float64Class, (double) value);
1851
+ }
1852
+ @JRubyMethod
1853
+ public RubyInteger as_i() {
1854
+ Ruby runtime = getRuntime();
1855
+ return PrimitiveService.__float64_to_i(runtime, value);
1856
+ }
1857
+ @JRubyMethod
1858
+ public RubyFloat as_f() {
1859
+ Ruby runtime = getRuntime();
1860
+ return PrimitiveService.__float64_to_f(runtime, value);
1861
+ }
1862
+ @JRubyMethod
1863
+ public RubyInteger to_i() {
1864
+ Ruby runtime = getRuntime();
1865
+ return PrimitiveService.__float64_to_i(runtime, value);
1866
+ }
1867
+ @JRubyMethod
1868
+ public RubyInteger to_int() {
1869
+ Ruby runtime = getRuntime();
1870
+ return PrimitiveService.__float64_to_i(runtime, value);
1871
+ }
1872
+ @JRubyMethod
1873
+ public RubyFloat to_f() {
1874
+ Ruby runtime = getRuntime();
1875
+ return PrimitiveService.__float64_to_f(runtime, value);
1876
+ }
1877
+ @JRubyMethod
1878
+ public RubyString to_s() {
1879
+ Ruby runtime = getRuntime();
1880
+ return RubyString.newString(runtime, PrimitiveService.__float64_to_s(runtime, value));
1881
+ }
1882
+ @JRubyMethod
1883
+ public RubyString inspect() {
1884
+ Ruby runtime = getRuntime();
1885
+ return RubyString.newString(runtime, PrimitiveService.__float64_to_s(runtime, value));
1886
+ }
1887
+ @JRubyMethod(name = "==")
1888
+ public RubyBoolean eq(IRubyObject o) {
1889
+ Ruby runtime = getRuntime();
1890
+ double v = PrimitiveService.__object_f64(runtime, o);
1891
+ return RubyBoolean.newBoolean(runtime, value == v);
1892
+ }
1893
+ @JRubyMethod(name = "!=")
1894
+ public RubyBoolean ne(IRubyObject o) {
1895
+ Ruby runtime = getRuntime();
1896
+ double v = PrimitiveService.__object_f64(runtime, o);
1897
+ return RubyBoolean.newBoolean(runtime, value != v);
1898
+ }
1899
+ @JRubyMethod(name = "+@")
1900
+ public Float64 pos() {
1901
+ Ruby runtime = getRuntime();
1902
+ return new Float64(PrimitiveService.Float64Class, +value);
1903
+ }
1904
+ @JRubyMethod(name = "-@")
1905
+ public Float64 neg() {
1906
+ Ruby runtime = getRuntime();
1907
+ return new Float64(PrimitiveService.Float64Class, -value);
1908
+ }
1909
+ @JRubyMethod(name = "*")
1910
+ public Float64 mul(IRubyObject o) {
1911
+ Ruby runtime = getRuntime();
1912
+ double v = PrimitiveService.__object_f64(runtime, o);
1913
+ return new Float64(PrimitiveService.Float64Class, value * v);
1914
+ }
1915
+ @JRubyMethod(name = "/")
1916
+ public Float64 div(IRubyObject o) {
1917
+ Ruby runtime = getRuntime();
1918
+ double v = PrimitiveService.__object_f64(runtime, o);
1919
+ return new Float64(PrimitiveService.Float64Class, PrimitiveService.__float64_div(runtime, value, v));
1920
+ }
1921
+ @JRubyMethod(name = "%")
1922
+ public Float64 mod(IRubyObject o) {
1923
+ Ruby runtime = getRuntime();
1924
+ double v = PrimitiveService.__object_f64(runtime, o);
1925
+ return new Float64(PrimitiveService.Float64Class, PrimitiveService.__float64_mod(runtime, value, v));
1926
+ }
1927
+ @JRubyMethod(name = "+")
1928
+ public Float64 add(IRubyObject o) {
1929
+ Ruby runtime = getRuntime();
1930
+ double v = PrimitiveService.__object_f64(runtime, o);
1931
+ return new Float64(PrimitiveService.Float64Class, value + v);
1932
+ }
1933
+ @JRubyMethod(name = "-")
1934
+ public Float64 sub(IRubyObject o) {
1935
+ Ruby runtime = getRuntime();
1936
+ double v = PrimitiveService.__object_f64(runtime, o);
1937
+ return new Float64(PrimitiveService.Float64Class, value - v);
1938
+ }
1939
+ @JRubyMethod(name = "<=>")
1940
+ public Int32 cmp(IRubyObject o) {
1941
+ Ruby runtime = getRuntime();
1942
+ double value = this.value;
1943
+ double v = PrimitiveService.__object_f64(runtime, o);
1944
+ if (value < v)
1945
+ return PrimitiveService.Int32_M1;
1946
+ if (value > v)
1947
+ return PrimitiveService.Int32_1;
1948
+ return PrimitiveService.Int32_0;
1949
+ }
1950
+ @JRubyMethod(name = "<")
1951
+ public RubyBoolean lt(IRubyObject o) {
1952
+ Ruby runtime = getRuntime();
1953
+ double v = PrimitiveService.__object_f64(runtime, o);
1954
+ return RubyBoolean.newBoolean(runtime, value < v);
1955
+ }
1956
+ @JRubyMethod(name = "<=")
1957
+ public RubyBoolean le(IRubyObject o) {
1958
+ Ruby runtime = getRuntime();
1959
+ double v = PrimitiveService.__object_f64(runtime, o);
1960
+ return RubyBoolean.newBoolean(runtime, value <= v);
1961
+ }
1962
+ @JRubyMethod(name = ">=")
1963
+ public RubyBoolean ge(IRubyObject o) {
1964
+ Ruby runtime = getRuntime();
1965
+ double v = PrimitiveService.__object_f64(runtime, o);
1966
+ return RubyBoolean.newBoolean(runtime, value >= v);
1967
+ }
1968
+ @JRubyMethod(name = ">")
1969
+ public RubyBoolean gt(IRubyObject o) {
1970
+ Ruby runtime = getRuntime();
1971
+ double v = PrimitiveService.__object_f64(runtime, o);
1972
+ return RubyBoolean.newBoolean(runtime, value > v);
1973
+ }
1974
+ @JRubyMethod(name = "zero?")
1975
+ public RubyBoolean is_zero() {
1976
+ Ruby runtime = getRuntime();
1977
+ return RubyBoolean.newBoolean(runtime, value == 0);
1978
+ }
1979
+ @JRubyMethod(name = "nan?")
1980
+ public RubyBoolean is_nan() {
1981
+ Ruby runtime = getRuntime();
1982
+ return RubyBoolean.newBoolean(runtime, Double.isNaN(value));
1983
+ }
1984
+ @JRubyMethod(name = "infinite?")
1985
+ public RubyBoolean is_infinite() {
1986
+ Ruby runtime = getRuntime();
1987
+ return RubyBoolean.newBoolean(runtime, Double.isInfinite(value));
1988
+ }
1989
+ @JRubyMethod(name = "finite?")
1990
+ public RubyBoolean is_finite() {
1991
+ Ruby runtime = getRuntime();
1992
+ return RubyBoolean.newBoolean(runtime, !Double.isNaN(value) && !Double.isInfinite(value));
1993
+ }
1994
+ }
1995
+ public boolean basicLoad(Ruby runtime) {
1996
+ Integer_x8000000000000000 = RubyBignum.newBignum(runtime, new java.math.BigInteger("8000000000000000", 0x10));
1997
+ Integer_xFFFFFFFFFFFFFFFF = RubyBignum.newBignum(runtime, new java.math.BigInteger("FFFFFFFFFFFFFFFF", 0x10));
1998
+ Integer_xM8000000000000000 = RubyFixnum.newFixnum(runtime, -0x8000000000000000L);
1999
+ RubyClass ObjectClass = runtime.getObject();
2000
+ ByteClass = runtime.defineClass("Byte", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2001
+ ByteClass.defineAnnotatedMethods(Byte.class);
2002
+ CharClass = runtime.defineClass("Char", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2003
+ CharClass.defineAnnotatedMethods(Char.class);
2004
+ Int16Class = runtime.defineClass("Int16", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2005
+ Int16Class.defineAnnotatedMethods(Int16.class);
2006
+ Int32Class = runtime.defineClass("Int32", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2007
+ Int32Class.defineAnnotatedMethods(Int32.class);
2008
+ Int64Class = runtime.defineClass("Int64", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2009
+ Int64Class.defineAnnotatedMethods(Int64.class);
2010
+ Float32Class = runtime.defineClass("Float32", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2011
+ Float32Class.defineAnnotatedMethods(Float32.class);
2012
+ Float32Class.defineConstant("NEGATIVE_INFINITY", new Float32(Float32Class, java.lang.Float.NEGATIVE_INFINITY));
2013
+ Float32Class.defineConstant("POSITIVE_INFINITY", new Float32(Float32Class, java.lang.Float.POSITIVE_INFINITY));
2014
+ Float64Class = runtime.defineClass("Float64", ObjectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2015
+ Float64Class.defineAnnotatedMethods(Float64.class);
2016
+ Float64Class.defineConstant("NEGATIVE_INFINITY", new Float64(Float64Class, java.lang.Float.NEGATIVE_INFINITY));
2017
+ Float64Class.defineConstant("POSITIVE_INFINITY", new Float64(Float64Class, java.lang.Float.POSITIVE_INFINITY));
2018
+ Int32_0 = new Int32(Int32Class, 0);
2019
+ Int32_1 = new Int32(Int32Class, 1);
2020
+ Int32_M1 = new Int32(Int32Class, -1);
2021
+ return true;
2022
+ }
2023
+ }