author | vranyj1 |
Fri, 10 Aug 2012 15:10:40 +0000 | |
branch | jk_new_structure |
changeset 1588 | b01c1a55490d |
parent 1581 | 70fbc03d2d82 |
child 1598 | 67d1b6811a57 |
permissions | -rw-r--r-- |
1532 | 1 |
"{ Package: 'stx:libjava' }"! |
1353 | 2 |
|
1376 | 3 |
!Behavior methodsFor:'queries'! |
4 |
||
5 |
isInterface |
|
6 |
"return true, if the receiver is a Java interface" |
|
7 |
||
8 |
^ false |
|
9 |
||
10 |
" |
|
11 |
True isInterface |
|
12 |
" |
|
13 |
||
14 |
"Created: / 22-02-2012 / 21:53:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
15 |
! ! |
|
1532 | 16 |
|
17 |
!Boolean class methodsFor:'queries'! |
|
18 |
||
19 |
isJavaPrimitiveType |
|
20 |
||
21 |
^true |
|
22 |
||
23 |
"Created: / 25-02-2011 / 08:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
24 |
! ! |
|
25 |
||
26 |
!Boolean class methodsFor:'queries'! |
|
27 |
||
28 |
javaArrayClass |
|
29 |
^ BooleanArray |
|
30 |
||
31 |
"Created: / 25-02-2011 / 08:27:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
32 |
! ! |
|
33 |
||
34 |
!Boolean class methodsFor:'autoboxing support'! |
|
35 |
||
36 |
javaBox: anObject |
|
37 |
| wrapper | |
|
38 |
||
39 |
wrapper := (JavaVM classForName: 'java.lang.Boolean') new. |
|
40 |
wrapper perform: #'<init>(Z)V' with: anObject. |
|
41 |
^ wrapper |
|
42 |
||
43 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
44 |
! ! |
|
45 |
||
46 |
!Boolean class methodsFor:'accessing'! |
|
47 |
||
48 |
javaName |
|
49 |
||
50 |
^'boolean'. |
|
51 |
||
52 |
"Modified: / 25-02-2011 / 18:58:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
53 |
! ! |
|
54 |
||
55 |
!Boolean class methodsFor:'autoboxing support'! |
|
56 |
||
57 |
javaUnbox: object onError: errorBlock |
|
58 |
||
59 |
| value | |
|
60 |
||
61 |
(object class name = 'java/lang/Boolean') ifFalse:[ |
|
62 |
errorBlock value. |
|
63 |
]. |
|
64 |
value := object instVarNamed: #value. |
|
65 |
(value ~~ 0 and:[value ~~ 1]) ifTrue:[ |
|
66 |
errorBlock value. |
|
67 |
]. |
|
68 |
^value |
|
69 |
||
70 |
"Created: / 22-11-2011 / 11:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 |
! ! |
|
72 |
||
73 |
!Boolean class methodsFor:'autoboxing support'! |
|
74 |
||
75 |
javaUnwrap: zeroOrOne |
|
76 |
||
77 |
^zeroOrOne == 1 |
|
78 |
||
79 |
"Created: / 10-12-2011 / 20:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
80 |
! ! |
|
81 |
||
82 |
!Boolean class methodsFor:'autoboxing support'! |
|
83 |
||
84 |
javaWrap: boolean |
|
85 |
||
86 |
^boolean ifTrue:[1] ifFalse:[0]. |
|
87 |
||
88 |
"Created: / 18-03-2012 / 22:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 |
! ! |
|
90 |
||
91 |
!Boolean class methodsFor:'accessing'! |
|
92 |
||
93 |
javaWrapperClass |
|
94 |
^(Java classForName: 'java.lang.Boolean') |
|
95 |
||
96 |
"Created: / 24-02-2012 / 19:43:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97 |
! ! |
|
98 |
||
752 | 99 |
!BooleanArray methodsFor:'queries'! |
100 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
101 |
isInterface |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
102 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
103 |
^false |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
104 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
105 |
"Created: / 31-05-2011 / 16:07:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
106 |
! ! |
1532 | 107 |
|
108 |
!BooleanArray class methodsFor:'testing'! |
|
109 |
||
110 |
isInterface |
|
111 |
||
112 |
^false |
|
113 |
! ! |
|
114 |
||
115 |
!BooleanArray class methodsFor:'queries'! |
|
116 |
||
117 |
isJavaArrayClass |
|
118 |
||
119 |
^true |
|
120 |
||
121 |
"Created: / 20-12-2010 / 22:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
122 |
! ! |
|
123 |
||
124 |
!BooleanArray class methodsFor:'queries'! |
|
125 |
||
126 |
isJavaReferenceType |
|
127 |
||
128 |
"Java arrays are reference types" |
|
129 |
^true |
|
130 |
||
131 |
"Created: / 20-12-2010 / 22:30:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
132 |
! ! |
|
133 |
||
134 |
!BooleanArray class methodsFor:'accessing-java'! |
|
135 |
||
136 |
javaArrayClass |
|
137 |
^ JavaArray javaArrayClassFor: self |
|
138 |
||
139 |
"Created: / 06-12-2011 / 17:29:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
140 |
! ! |
|
141 |
||
142 |
!BooleanArray class methodsFor:'accessing-java'! |
|
143 |
||
144 |
javaComponentClass |
|
145 |
||
146 |
^Boolean |
|
147 |
||
148 |
"Created: / 20-12-2010 / 22:13:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
149 |
! ! |
|
150 |
||
151 |
!BooleanArray class methodsFor:'accessing'! |
|
152 |
||
153 |
javaName |
|
154 |
||
155 |
^'[Z'. |
|
156 |
||
157 |
"Modified: / 31-08-2011 / 23:57:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
158 |
! ! |
|
159 |
||
160 |
!ByteArray class methodsFor:'testing'! |
|
161 |
||
162 |
isInterface |
|
163 |
||
164 |
^false |
|
165 |
! ! |
|
166 |
||
167 |
!ByteArray class methodsFor:'queries'! |
|
168 |
||
169 |
isJavaArrayClass |
|
170 |
||
171 |
^true |
|
172 |
||
173 |
"Created: / 05-02-2011 / 22:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
174 |
! ! |
|
175 |
||
176 |
!ByteArray class methodsFor:'queries'! |
|
177 |
||
178 |
isJavaReferenceType |
|
179 |
||
180 |
"Java arrays are reference types" |
|
181 |
^true |
|
182 |
||
183 |
"Created: / 20-12-2010 / 22:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184 |
! ! |
|
185 |
||
186 |
!ByteArray class methodsFor:'accessing-java'! |
|
187 |
||
188 |
javaArrayClass |
|
189 |
||
190 |
^JavaArray javaArrayClassFor: self |
|
191 |
||
192 |
"Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
193 |
! ! |
|
194 |
||
195 |
!ByteArray class methodsFor:'accessing-java'! |
|
196 |
||
197 |
javaComponentClass |
|
198 |
||
199 |
^JavaByte |
|
200 |
||
201 |
"Created: / 20-12-2010 / 22:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
202 |
! ! |
|
203 |
||
204 |
!ByteArray class methodsFor:'accessing'! |
|
205 |
||
206 |
javaName |
|
207 |
||
208 |
^'[B'. |
|
209 |
||
210 |
"Modified: / 25-02-2011 / 19:02:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
211 |
! ! |
|
212 |
||
213 |
!Character class methodsFor:'queries'! |
|
214 |
||
215 |
isJavaPrimitiveType |
|
216 |
||
217 |
^true |
|
218 |
||
219 |
"Created: / 20-12-2010 / 22:18:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
220 |
! ! |
|
221 |
||
222 |
!Character class methodsFor:'accessing'! |
|
223 |
||
224 |
javaArrayClass |
|
225 |
^ String |
|
226 |
||
227 |
"Created: / 11-02-2011 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 |
! ! |
|
229 |
||
230 |
!Character class methodsFor:'autoboxing support'! |
|
231 |
||
232 |
javaBox: anObject |
|
233 |
| wrapper | |
|
234 |
||
235 |
wrapper := (JavaVM classForName: 'java.lang.Character') new. |
|
236 |
wrapper perform: #'<init>(C)V' with: anObject codePoint. |
|
237 |
^ wrapper |
|
238 |
||
239 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
240 |
! ! |
|
241 |
||
242 |
!Character class methodsFor:'accessing'! |
|
243 |
||
244 |
javaName |
|
245 |
||
246 |
^'char'. |
|
247 |
||
248 |
"Modified: / 25-02-2011 / 18:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
249 |
! ! |
|
250 |
||
251 |
!Character class methodsFor:'autoboxing support'! |
|
252 |
||
253 |
javaUnbox: object onError: errorBlock |
|
254 |
||
255 |
| value | |
|
256 |
||
257 |
(object class name = 'java/lang/Character') ifFalse:[ |
|
258 |
errorBlock value. |
|
259 |
]. |
|
260 |
value := object instVarNamed: #value. |
|
261 |
(value between: 0 and: 255) ifFalse:[ |
|
262 |
errorBlock value. |
|
263 |
]. |
|
264 |
^value |
|
265 |
||
266 |
"Created: / 22-11-2011 / 11:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
267 |
! ! |
|
268 |
||
269 |
!Character class methodsFor:'accessing'! |
|
270 |
||
271 |
javaWrapperClass |
|
272 |
^(Java classForName: 'java.lang.Character') |
|
273 |
||
274 |
"Created: / 24-02-2012 / 19:42:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
275 |
! ! |
|
276 |
||
1032 | 277 |
!CharacterArray methodsFor:'java conversions'! |
278 |
||
1061 | 279 |
asDottedJavaClassName |
280 |
||
281 |
" |
|
282 |
examples: |
|
1159 | 283 |
java.lang.String |
1061 | 284 |
[[[Ljava/lang/Object; => java.lang.Object |
285 |
" |
|
286 |
||
287 |
||
288 |
| nm | |
|
289 |
nm := self asJavaComponentClassName. |
|
290 |
(nm startsWith: $L) ifTrue: [ |
|
1159 | 291 |
nm := nm copyFrom: 2 to: nm size - 1 |
1061 | 292 |
]. |
293 |
(nm includes: $/) ifTrue: [ |
|
1159 | 294 |
nm := nm asString copyReplaceAll: $/ with: $. |
1061 | 295 |
]. |
296 |
^ nm. |
|
297 |
||
298 |
"Created: / 21-10-2011 / 12:31:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
299 |
"Created: / 30-10-2011 / 17:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
300 |
! ! |
|
1532 | 301 |
|
1061 | 302 |
!CharacterArray methodsFor:'java conversions'! |
303 |
||
1036 | 304 |
asInternalJavaClassName |
1060 | 305 |
|
306 |
<resource: #obsolete> |
|
307 |
||
308 |
^self asSlashedJavaClassName |
|
1036 | 309 |
|
310 |
"Created: / 21-10-2011 / 12:31:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1060 | 311 |
"Modified: / 30-10-2011 / 17:40:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 312 |
! ! |
1532 | 313 |
|
1036 | 314 |
!CharacterArray methodsFor:'java conversions'! |
315 |
||
1032 | 316 |
asJavaComponentClassName |
317 |
| componentClassName | |
|
318 |
||
319 |
componentClassName := self utf8Encoded. |
|
320 |
(componentClassName matches: '*\[*') ifTrue: [ |
|
1159 | 321 |
componentClassName := componentClassName |
322 |
copyFrom: (componentClassName lastIndexOf: $[) + 1 |
|
323 |
to: componentClassName size. |
|
324 |
]. |
|
1032 | 325 |
^ componentClassName. |
326 |
! ! |
|
1532 | 327 |
|
1032 | 328 |
!CharacterArray methodsFor:'java conversions'! |
329 |
||
1036 | 330 |
asJavaishClassName |
1060 | 331 |
|
332 |
<resource: #obsolete> |
|
333 |
||
334 |
^self asDottedJavaClassName. |
|
1036 | 335 |
|
336 |
"Created: / 21-10-2011 / 12:33:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1060 | 337 |
"Modified: / 30-10-2011 / 17:41:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 338 |
! ! |
1532 | 339 |
|
1036 | 340 |
!CharacterArray methodsFor:'java conversions'! |
341 |
||
1032 | 342 |
asNiceJavaClassName |
343 |
| niceName | |
|
344 |
||
345 |
niceName := self asJavaComponentClassName asSTXInternalJavaClassName. |
|
346 |
(self occurrencesOf: $[) timesRepeat: [ niceName := niceName , '[]' ]. |
|
347 |
niceName := niceName asString copyReplaceAll: $/ with: $.. |
|
348 |
^ niceName. |
|
349 |
! ! |
|
1532 | 350 |
|
1032 | 351 |
!CharacterArray methodsFor:'java conversions'! |
352 |
||
353 |
asSTXInternalJavaClassName |
|
354 |
| internalName | |
|
355 |
||
356 |
internalName := self asJavaComponentClassName. |
|
357 |
(internalName startsWith: $L) ifTrue: [ |
|
1159 | 358 |
internalName := internalName copyFrom: 2 to: internalName size - 1 |
1032 | 359 |
]. |
360 |
(internalName includes: $.) ifTrue: [ |
|
1159 | 361 |
internalName := internalName asString copyReplaceAll: $. with: $/ |
1032 | 362 |
]. |
363 |
^internalName. |
|
364 |
! ! |
|
1532 | 365 |
|
1061 | 366 |
!CharacterArray methodsFor:'java conversions'! |
367 |
||
368 |
asSlashedJavaClassName |
|
369 |
"removes square brackets and adds slashes" |
|
370 |
| internalName | |
|
371 |
internalName := self asJavaComponentClassName. |
|
372 |
(internalName startsWith: $L) ifTrue: [ |
|
1159 | 373 |
internalName := internalName copyFrom: 2 to: internalName size - 1 |
1061 | 374 |
]. |
375 |
(internalName includes: $.) ifTrue: [ |
|
1159 | 376 |
internalName := internalName asString copyReplaceAll: $. with: $/ |
1061 | 377 |
]. |
378 |
^ internalName. |
|
379 |
||
380 |
"Created: / 21-10-2011 / 12:31:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
381 |
"Created: / 30-10-2011 / 17:40:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
382 |
! ! |
|
1532 | 383 |
|
1032 | 384 |
!CharacterArray methodsFor:'java queries'! |
385 |
||
386 |
isJavaArrayDescriptor |
|
387 |
^ self startsWith:$[. |
|
388 |
! ! |
|
1532 | 389 |
|
1032 | 390 |
!CharacterArray methodsFor:'java queries'! |
391 |
||
392 |
isJavaPrimitiveTypeDescriptor |
|
393 |
^ (self size = 1 and: [ JavaDescriptor baseTypes includesKey: self first ]). |
|
394 |
! ! |
|
1190 | 395 |
|
752 | 396 |
!CharacterArray class methodsFor:'encoding & decoding'! |
397 |
||
1159 | 398 |
decodeFromJavaUTF8: bytes |
752 | 399 |
"Decodes a string from modified UTF8 encoding |
400 |
as used in Java .class files. see |
|
401 |
'The class file format specification', section 4.5.7" |
|
1159 | 402 |
|
752 | 403 |
| string i s b codePoint realLength | |
404 |
||
405 |
string := String new: bytes size. |
|
406 |
realLength := bytes size. |
|
407 |
s := bytes readStream. |
|
408 |
i := 1. |
|
1159 | 409 |
[ s atEnd ] whileFalse: |
1253 | 410 |
[ b := s next. |
411 |
(b & 2r10000000) == 0 |
|
412 |
ifTrue: [ codePoint := b ] |
|
413 |
ifFalse: |
|
414 |
[ self assert: (b & 2r01000000) = 2r01000000. |
|
415 |
(b & 2r00100000) = 0 |
|
416 |
ifTrue: |
|
417 |
[ "two byte utf char" |
|
418 |
realLength := realLength - 1. |
|
419 |
self assert: s size > 0. |
|
420 |
self assert: (b & 2r01000000) = 2r01000000. |
|
421 |
string bitsPerCharacter < 16 |
|
422 |
ifTrue: [ string := Unicode16String fromString: string ]. |
|
423 |
codePoint := (b & 2r00011111) << 6. |
|
424 |
b := s next. |
|
425 |
self assert: (b & 2r11000000) = 2r10000000. |
|
426 |
codePoint := codePoint + (b & 2r00111111). ] |
|
427 |
ifFalse: |
|
428 |
[ "at lease 3 byte utf char" |
|
429 |
realLength := realLength - 2. |
|
430 |
string bitsPerCharacter < 16"was: 32" |
|
431 |
ifTrue: [ string := Unicode16String"was: Unicode32String" fromString: string ]. |
|
432 |
self assert: s size > 1. |
|
433 |
(b & 2r00010000) = 0 |
|
434 |
ifTrue: |
|
435 |
[ | utf32Possible utf32Value | |
|
752 | 436 |
|
1253 | 437 |
"3 or 6 byte utf char" |
438 |
self assert: s size > 1. |
|
439 |
s size < 5 |
|
440 |
ifTrue: [ utf32Possible := false ] |
|
441 |
ifFalse: [ utf32Possible := true ]. |
|
442 |
b ~= 2r11101101 ifTrue: [ utf32Possible := false ]. |
|
443 |
codePoint := (b & 2r00001111) << 12. |
|
444 |
b := s next. |
|
445 |
self assert: (b & 2r11000000) = 2r10000000. |
|
446 |
((b & 2r11110000) = 2r10100000 and: [ utf32Possible ]) |
|
447 |
ifTrue: [ utf32Value := 2r00010000 + ((b & 2r00001111) << 16) ] |
|
448 |
ifFalse: [ utf32Possible := false ]. |
|
449 |
codePoint := codePoint + ((b & 2r00111111) << 6). |
|
450 |
b := s next. |
|
451 |
self assert: (b & 2r11000000) = 2r10000000. |
|
452 |
utf32Possible |
|
453 |
ifTrue: [ utf32Value := utf32Value + ((b & 2r00111111) << 10) ]. |
|
454 |
codePoint := codePoint + (b & 2r00111111). |
|
455 |
utf32Possible |
|
456 |
ifTrue: |
|
457 |
[ | tmpB | |
|
752 | 458 |
|
1253 | 459 |
string bitsPerCharacter < 32 |
460 |
ifTrue: [ string := Unicode32String fromString: string ]. |
|
461 |
tmpB := s copy. |
|
462 |
b := tmpB next. |
|
463 |
b = 2r11101101 |
|
464 |
ifTrue: |
|
465 |
[ b := tmpB next. |
|
466 |
(b & 2r11110000) = 2r10110000 |
|
467 |
ifTrue: |
|
468 |
[ utf32Value := utf32Value + ((b & 2r00001111) << 6). |
|
469 |
b := tmpB next. |
|
470 |
self assert: (b & 2r11000000) = 2r10000000. |
|
471 |
utf32Value := utf32Value + (b & 2r00111111). |
|
472 |
codePoint := utf32Value. |
|
473 |
realLength := realLength - 3. s position: tmpB position.] ] ] ] |
|
474 |
ifFalse: |
|
475 |
[ "should not happen, ask mh" |
|
476 |
self halt. ] ] ]. |
|
477 |
string at: i put: (Character codePoint: codePoint). |
|
478 |
i := i + 1. ]. |
|
752 | 479 |
^ string subString: 1 to: realLength. |
480 |
||
481 |
" |
|
1253 | 482 |
String decodeFromJavaUTF8: 'Hello world' asByteArray" |
752 | 483 |
|
484 |
"Created: / 22-12-2010 / 23:45:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
485 |
"Modified: / 09-02-2011 / 01:12:25 / Marcel Hlopko <hlopik@gmail.com>" |
|
486 |
"Modified: / 13-03-2011 / 15:52:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1253 | 487 |
"Modified: / 09-12-2011 / 19:49:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 488 |
! ! |
1532 | 489 |
|
752 | 490 |
!CharacterArray class methodsFor:'instance creation'! |
491 |
||
492 |
fromJavaUTF8Bytes:aByteCollection |
|
493 |
"return a new string which represents the characters as decoded |
|
1159 | 494 |
from the modified utf8 encoded bytes as specified in |
752 | 495 |
The class file format specification, section 4.5.7" |
496 |
||
497 |
^ self decodeFromJavaUTF8:aByteCollection. |
|
498 |
||
499 |
" |
|
500 |
CharacterArray fromUTF8Bytes:#[ 16r41 16r42 ] |
|
501 |
CharacterArray fromUTF8Bytes:#[ 16rC1 16r02 ] |
|
502 |
CharacterArray fromUTF8Bytes:#[ 16rE0 16r81 16r02 ] |
|
503 |
CharacterArray fromUTF8Bytes:#[ 16rEF 16rBF 16rBF ] |
|
504 |
||
505 |
rfc2279 examples: |
|
506 |
CharacterArray fromUTF8Bytes:#[ 16r41 16rE2 16r89 16rA2 16rCE 16r91 16r2E ] |
|
507 |
CharacterArray fromUTF8Bytes:#[ 16rED 16r95 16r9C 16rEA 16rB5 16rAD 16rEC 16r96 16rB4 ] |
|
508 |
CharacterArray fromUTF8Bytes:#[ 16rE6 16r97 16rA5 16rE6 16r9C 16rAC 16rE8 16rAA 16r9E ] |
|
509 |
||
510 |
invalid: |
|
511 |
CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ] |
|
512 |
CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ] |
|
513 |
" |
|
514 |
||
515 |
"Created: / 23-12-2010 / 09:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
516 |
! ! |
|
1532 | 517 |
|
865 | 518 |
!CharacterArray class methodsFor:'queries'! |
519 |
||
520 |
isJavaArrayClass |
|
521 |
||
522 |
^true |
|
523 |
||
524 |
"Created: / 05-02-2011 / 22:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
525 |
! ! |
|
1532 | 526 |
|
865 | 527 |
!CharacterArray class methodsFor:'accessing-java'! |
528 |
||
529 |
javaArrayClass |
|
530 |
||
901 | 531 |
^JavaArray javaArrayClassFor: Unicode16String |
865 | 532 |
|
533 |
"Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
901 | 534 |
"Modified: / 10-08-2011 / 13:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
865 | 535 |
! ! |
1532 | 536 |
|
865 | 537 |
!CharacterArray class methodsFor:'accessing-java'! |
538 |
||
539 |
javaComponentClass |
|
540 |
||
541 |
^Character |
|
542 |
||
543 |
"Created: / 20-12-2010 / 22:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
544 |
! ! |
|
1532 | 545 |
|
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
546 |
!Class methodsFor:'accessing - java'! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
547 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
548 |
javaMirror |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
549 |
^self javaMirrorClass forClass: self. |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
550 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
551 |
"Created: / 31-07-2012 / 17:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
552 |
! ! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
553 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
554 |
!Class methodsFor:'accessing - java'! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
555 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
556 |
javaMirrorClass |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
557 |
^self isJavaPrimitiveType ifTrue:[ |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
558 |
JavaMirror mirrorClassForJavaPrimitive |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
559 |
] ifFalse:[ |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
560 |
JavaMirror mirrorClassForAlienClass |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
561 |
] |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
562 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
563 |
"Created: / 31-07-2012 / 17:39:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
564 |
! ! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
565 |
|
1368 | 566 |
!ConfigurableFeatures class methodsFor:'queries-features'! |
567 |
||
568 |
hasJavaSupport |
|
569 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator |
|
570 |
^ (Smalltalk at: #'JavaVM' ifAbsent:nil) notNil |
|
571 |
||
572 |
" |
|
573 |
ConfigurableFeatures hasJavaSupport |
|
574 |
ConfigurableFeatures includesFeature:#JavaSupport |
|
575 |
" |
|
576 |
||
577 |
"Created: / 03-01-2012 / 15:36:03 / cg" |
|
578 |
"Created: / 18-02-2012 / 16:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
579 |
! ! |
|
1532 | 580 |
|
581 |
!Delay methodsFor:'delaying'! |
|
582 |
||
583 |
waitWithState:state |
|
584 |
"suspend the current process until either the relative time delta |
|
585 |
has passed (if millisecondDelta is non-nil), or the absolute millisecondTime |
|
586 |
has been reached (if resumptionTime non-nil)." |
|
587 |
||
588 |
| wasBlocked currentDelta dueTime now then | |
|
589 |
isInterrupted := false. |
|
590 |
millisecondDelta notNil ifTrue: [ |
|
591 |
now := OperatingSystem getMillisecondTime. |
|
592 |
currentDelta := millisecondDelta rounded. |
|
593 |
currentDelta > 16r0fffffff ifTrue: [ |
|
594 |
"NOTE: the microsecondTime is increasing monotonically, |
|
595 |
while millisecondTime is wrapping at 16r1fffffff. |
|
596 |
So use the microsecondTime to check when we are finished" |
|
597 |
dueTime := OperatingSystem getMicrosecondTime + (currentDelta * 1000). |
|
598 |
currentDelta := 16r0fffffff. |
|
599 |
]. |
|
600 |
then := OperatingSystem millisecondTimeAdd: now and: currentDelta. |
|
601 |
] ifFalse: [ then := resumptionTime. ]. |
|
602 |
wasBlocked := OperatingSystem blockInterrupts. |
|
603 |
[ |
|
604 |
[ |
|
605 |
Processor signal: delaySemaphore atMilliseconds: then. |
|
606 |
Processor activeProcess state: state. |
|
607 |
delaySemaphore wait. |
|
608 |
] doWhile: [ |
|
609 |
(dueTime notNil |
|
610 |
and: [ |
|
611 |
isInterrupted not |
|
612 |
and: [ (currentDelta := dueTime - OperatingSystem getMicrosecondTime) > 0 ] |
|
613 |
]) |
|
614 |
ifTrue: [ |
|
615 |
currentDelta := (currentDelta // 1000) min: 16r0fffffff. |
|
616 |
now := OperatingSystem getMillisecondTime. |
|
617 |
then := OperatingSystem millisecondTimeAdd: now and: currentDelta. |
|
618 |
true. |
|
619 |
] |
|
620 |
ifFalse: [ false ] |
|
621 |
]. |
|
622 |
] ensure: [ wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. ] |
|
623 |
||
624 |
" |
|
625 |
Transcript showCR:'1'. |
|
626 |
(Delay forSeconds:10) wait. |
|
627 |
Transcript showCR:'2'." |
|
628 |
||
629 |
"Modified: / 26-02-1997 / 15:21:35 / cg" |
|
630 |
"Modified: / 18-04-1997 / 11:56:46 / stefan" |
|
631 |
"Created: / 30-11-2011 / 13:38:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
632 |
! ! |
|
633 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
634 |
!DoubleArray class methodsFor:'testing'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
635 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
636 |
isInterface |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
637 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
638 |
^false |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
639 |
! ! |
1532 | 640 |
|
752 | 641 |
!DoubleArray class methodsFor:'queries'! |
642 |
||
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
643 |
isJavaArrayClass |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
644 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
645 |
^true |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
646 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
647 |
"Created: / 20-12-2010 / 22:47:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
648 |
! ! |
1532 | 649 |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
650 |
!DoubleArray class methodsFor:'queries'! |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
651 |
|
752 | 652 |
isJavaReferenceType |
653 |
||
654 |
"Java arrays are reference types" |
|
655 |
^true |
|
656 |
||
657 |
"Created: / 20-12-2010 / 22:30:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
658 |
! ! |
|
1532 | 659 |
|
752 | 660 |
!DoubleArray class methodsFor:'accessing-java'! |
661 |
||
1226 | 662 |
javaArrayClass |
663 |
^ JavaArray javaArrayClassFor: self. |
|
664 |
||
665 |
"Created: / 06-12-2011 / 17:28:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
666 |
! ! |
|
1532 | 667 |
|
1226 | 668 |
!DoubleArray class methodsFor:'accessing-java'! |
669 |
||
752 | 670 |
javaComponentClass |
671 |
||
672 |
^Float |
|
673 |
||
674 |
"Created: / 20-12-2010 / 22:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
675 |
! ! |
|
1532 | 676 |
|
752 | 677 |
!DoubleArray class methodsFor:'accessing'! |
678 |
||
679 |
javaName |
|
680 |
||
681 |
^'[D'. |
|
682 |
||
683 |
"Modified: / 25-02-2011 / 19:03:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
684 |
! ! |
|
1532 | 685 |
|
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
686 |
!ExecutableFunction methodsFor:'queries'! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
687 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
688 |
isJavaConstructor |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
689 |
^ false |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
690 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
691 |
"Created: / 31-07-2012 / 18:42:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
692 |
! ! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1570
diff
changeset
|
693 |
|
752 | 694 |
!Float class methodsFor:'queries'! |
695 |
||
696 |
isJavaPrimitiveType |
|
697 |
||
698 |
^true |
|
699 |
||
700 |
"Created: / 06-02-2011 / 17:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
701 |
! ! |
|
1532 | 702 |
|
752 | 703 |
!Float class methodsFor:'accessing'! |
704 |
||
851 | 705 |
javaArrayClass |
706 |
^ DoubleArray |
|
707 |
||
708 |
"Created: / 11-02-2011 / 10:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
709 |
! ! |
|
1532 | 710 |
|
917 | 711 |
!Float class methodsFor:'autoboxing support'! |
712 |
||
1159 | 713 |
javaBox: anObject |
917 | 714 |
| wrapper | |
715 |
||
1033 | 716 |
wrapper := (JavaVM classForName: 'java.lang.Double') new. |
917 | 717 |
wrapper perform: #'<init>(D)V' with: anObject. |
1033 | 718 |
^ wrapper |
917 | 719 |
|
720 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
721 |
! ! |
|
1532 | 722 |
|
851 | 723 |
!Float class methodsFor:'accessing'! |
724 |
||
752 | 725 |
javaName |
726 |
||
727 |
^'double'. |
|
728 |
||
729 |
"Modified: / 25-02-2011 / 18:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
730 |
! ! |
|
1532 | 731 |
|
1386 | 732 |
!Float class methodsFor:'accessing'! |
733 |
||
734 |
javaWrapperClass |
|
735 |
^(Java classForName: 'java.lang.Double') |
|
736 |
||
737 |
"Created: / 24-02-2012 / 19:42:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
738 |
! ! |
|
1532 | 739 |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
740 |
!FloatArray class methodsFor:'testing'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
741 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
742 |
isInterface |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
743 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
744 |
^false |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
745 |
! ! |
1532 | 746 |
|
752 | 747 |
!FloatArray class methodsFor:'queries'! |
748 |
||
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
749 |
isJavaArrayClass |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
750 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
751 |
^true |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
752 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
753 |
"Created: / 20-12-2010 / 22:47:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
754 |
! ! |
1532 | 755 |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
756 |
!FloatArray class methodsFor:'queries'! |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
757 |
|
752 | 758 |
isJavaReferenceType |
759 |
||
760 |
"Java arrays are reference types" |
|
761 |
^true |
|
762 |
||
763 |
"Created: / 20-12-2010 / 22:30:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
764 |
! ! |
|
1532 | 765 |
|
752 | 766 |
!FloatArray class methodsFor:'accessing-java'! |
767 |
||
1226 | 768 |
javaArrayClass |
769 |
^ JavaArray javaArrayClassFor: self. |
|
770 |
||
771 |
"Created: / 06-12-2011 / 17:29:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
772 |
! ! |
|
1532 | 773 |
|
1226 | 774 |
!FloatArray class methodsFor:'accessing-java'! |
775 |
||
752 | 776 |
javaComponentClass |
777 |
||
778 |
^ShortFloat |
|
779 |
||
780 |
"Created: / 20-12-2010 / 22:06:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
781 |
! ! |
|
1532 | 782 |
|
752 | 783 |
!FloatArray class methodsFor:'accessing'! |
784 |
||
785 |
javaName |
|
786 |
||
787 |
^'[F'. |
|
788 |
||
789 |
"Modified: / 25-02-2011 / 19:03:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
790 |
! ! |
|
1532 | 791 |
|
752 | 792 |
!Integer class methodsFor:'queries'! |
793 |
||
794 |
isJavaPrimitiveType |
|
795 |
||
796 |
^true |
|
797 |
||
798 |
"Created: / 11-02-2011 / 11:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
799 |
! ! |
|
1532 | 800 |
|
752 | 801 |
!Integer class methodsFor:'accessing'! |
802 |
||
851 | 803 |
javaArrayClass |
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
866
diff
changeset
|
804 |
^ SignedIntegerArray |
851 | 805 |
|
806 |
"Created: / 11-02-2011 / 10:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
807 |
! ! |
|
1532 | 808 |
|
917 | 809 |
!Integer class methodsFor:'autoboxing support'! |
810 |
||
1159 | 811 |
javaBox: anObject |
917 | 812 |
| wrapper | |
813 |
||
1033 | 814 |
wrapper := (JavaVM classForName: 'java.lang.Integer') new. |
917 | 815 |
wrapper perform: #'<init>(I)V' with: anObject. |
1033 | 816 |
^ wrapper |
917 | 817 |
|
818 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
819 |
! ! |
|
1532 | 820 |
|
851 | 821 |
!Integer class methodsFor:'accessing'! |
822 |
||
752 | 823 |
javaName |
824 |
||
825 |
^'int'. |
|
826 |
||
827 |
"Modified: / 25-02-2011 / 18:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
828 |
! ! |
|
1532 | 829 |
|
1204 | 830 |
!Integer class methodsFor:'autoboxing support'! |
831 |
||
832 |
javaUnbox: object onError: errorBlock |
|
833 |
||
834 |
^self javaUnbox: object onError: errorBlock |
|
835 |
min: "Integer.MIN_VALUE"-2147483648 |
|
836 |
max: "Integer.MAX_VALUE" 2147483647 |
|
837 |
||
838 |
"Created: / 25-11-2011 / 19:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
839 |
! ! |
|
1532 | 840 |
|
1205 | 841 |
!Integer class methodsFor:'autoboxing support'! |
842 |
||
843 |
javaUnbox: object onError: errorBlock min: min max: max |
|
844 |
||
845 |
| value | |
|
846 |
||
847 |
(#( 'java/lang/Byte' |
|
848 |
'java/lang/Short' |
|
849 |
'java/lang/Integer' |
|
850 |
"'java/lang/Long'" ) includes: object class name) ifFalse:[ |
|
851 |
errorBlock value. |
|
852 |
]. |
|
853 |
||
854 |
value := object instVarNamed:#value. |
|
855 |
(value between: min and: max) ifFalse:[ |
|
856 |
errorBlock value. |
|
857 |
]. |
|
858 |
^value |
|
859 |
||
860 |
"Created: / 22-11-2011 / 11:43:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
861 |
! ! |
|
1532 | 862 |
|
1386 | 863 |
!Integer class methodsFor:'accessing'! |
864 |
||
865 |
javaWrapperClass |
|
866 |
^(Java classForName: 'java.lang.Integer') |
|
867 |
||
868 |
"Created: / 24-02-2012 / 19:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
869 |
! ! |
|
1532 | 870 |
|
752 | 871 |
!LargeInteger class methodsFor:'queries'! |
872 |
||
873 |
isJavaPrimitiveType |
|
874 |
||
875 |
^true |
|
876 |
||
877 |
"Created: / 04-02-2011 / 11:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
878 |
! ! |
|
1532 | 879 |
|
752 | 880 |
!LargeInteger class methodsFor:'accessing'! |
881 |
||
851 | 882 |
javaArrayClass |
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
866
diff
changeset
|
883 |
^ SignedLongIntegerArray |
851 | 884 |
|
885 |
"Created: / 11-02-2011 / 10:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
886 |
! ! |
|
1532 | 887 |
|
917 | 888 |
!LargeInteger class methodsFor:'autoboxing support'! |
889 |
||
1159 | 890 |
javaBox: anObject |
917 | 891 |
| wrapper | |
892 |
||
1033 | 893 |
wrapper := (JavaVM classForName: 'java.lang.Long') new. |
917 | 894 |
wrapper perform: #'<init>(J)V' with: anObject. |
1033 | 895 |
^ wrapper |
917 | 896 |
|
897 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
898 |
! ! |
|
1532 | 899 |
|
851 | 900 |
!LargeInteger class methodsFor:'accessing'! |
901 |
||
752 | 902 |
javaName |
903 |
||
904 |
^'long'. |
|
905 |
||
906 |
"Modified: / 25-02-2011 / 18:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
907 |
! ! |
|
1532 | 908 |
|
1204 | 909 |
!LargeInteger class methodsFor:'autoboxing support'! |
910 |
||
911 |
javaUnbox: object onError: errorBlock |
|
912 |
||
913 |
| value | |
|
914 |
||
915 |
(object class name = 'java/lang/Long') ifFalse:[ |
|
916 |
errorBlock value. |
|
917 |
]. |
|
918 |
||
919 |
value := object instVarNamed:#value. |
|
920 |
(value between: "Integer.MIN_VALUE"-9223372036854775808 and: "Integer.MAX_VALUE" 9223372036854775807) ifFalse:[ |
|
921 |
errorBlock value. |
|
922 |
]. |
|
923 |
^value |
|
924 |
||
925 |
"Created: / 22-11-2011 / 11:45:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
926 |
! ! |
|
1532 | 927 |
|
1386 | 928 |
!LargeInteger class methodsFor:'accessing'! |
929 |
||
930 |
javaWrapperClass |
|
931 |
^(Java classForName: 'java.lang.Long') |
|
932 |
||
933 |
"Created: / 24-02-2012 / 19:42:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
934 |
! ! |
|
1532 | 935 |
|
936 |
!Object methodsFor:'testing'! |
|
937 |
||
938 |
isGroovyClass |
|
939 |
^false |
|
940 |
||
941 |
"Created: / 18-02-2012 / 20:29:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
942 |
! ! |
|
943 |
||
944 |
!Object methodsFor:'testing'! |
|
945 |
||
946 |
isJavaArray |
|
947 |
||
948 |
^self class isJavaArrayClass |
|
949 |
||
950 |
"Created: / 19-12-2010 / 17:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
951 |
! ! |
|
952 |
||
953 |
!Object methodsFor:'testing'! |
|
954 |
||
955 |
isJavaNameAndType |
|
956 |
"return true, if given object represents name and type struct in java constant pool" |
|
957 |
||
958 |
^ false. |
|
959 |
||
960 |
"Created: / 10-05-2011 / 12:21:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
961 |
! ! |
|
962 |
||
963 |
!Object methodsFor:'testing'! |
|
964 |
||
965 |
isJavaPackage |
|
966 |
"return true, if the receiver is a java package. |
|
967 |
False is returned here - the method is only redefined in JavaPackage." |
|
968 |
||
969 |
^ false |
|
970 |
||
971 |
"Created: / 09-08-2011 / 09:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
972 |
! ! |
|
973 |
||
974 |
!Object methodsFor:'testing'! |
|
975 |
||
976 |
isJavaRef |
|
977 |
"return true, if given object represents reference in java constant pool" |
|
978 |
^ false. |
|
979 |
||
980 |
"Created: / 08-04-2011 / 16:12:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
981 |
! ! |
|
982 |
||
983 |
!Object methodsFor:'testing'! |
|
984 |
||
985 |
isJavaWrapperClass |
|
986 |
"return true, if this is a java wrapper class, i.e, java.lang.Integer, java.lang.Boolean etc." |
|
987 |
||
988 |
^ false |
|
989 |
||
990 |
"Created: / 01-01-2012 / 17:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
991 |
! ! |
|
992 |
||
993 |
!Object methodsFor:'autoboxing support'! |
|
994 |
||
995 |
javaBox: anObject |
|
996 |
||
997 |
^anObject |
|
998 |
||
999 |
"Created: / 15-08-2011 / 10:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1000 |
! ! |
|
1001 |
||
1002 |
!Object methodsFor:'autoboxing support'! |
|
1003 |
||
1004 |
javaUnwrap: anObject |
|
1005 |
"Unwraps the objects. Possibly call on the wrapped class" |
|
1006 |
||
1007 |
^anObject |
|
1008 |
||
1009 |
"Created: / 10-12-2011 / 19:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1010 |
! ! |
|
1011 |
||
1012 |
!Object methodsFor:'autoboxing support'! |
|
1013 |
||
1014 |
javaUnwrapFrom: javaType |
|
1015 |
^ self. |
|
1016 |
||
1017 |
"Created: / 10-12-2011 / 19:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1018 |
"Created: / 30-12-2011 / 15:22:06 / kursjan <kursjan@fit.cvut.cz>" |
|
1019 |
! ! |
|
1020 |
||
1021 |
!Object methodsFor:'autoboxing support'! |
|
1022 |
||
1023 |
javaWrap: anObject |
|
1024 |
"Wraps the receiver into corresponding Java object" |
|
1025 |
||
1026 |
^anObject |
|
1027 |
||
1028 |
"Created: / 26-12-2011 / 00:57:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1029 |
! ! |
|
1030 |
||
752 | 1031 |
!Object class methodsFor:'queries'! |
1032 |
||
1033 |
isJavaArrayClass |
|
1034 |
||
1035 |
^false |
|
1036 |
||
1037 |
"Created: / 19-12-2010 / 17:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1038 |
! ! |
|
1532 | 1039 |
|
752 | 1040 |
!Object class methodsFor:'queries'! |
1041 |
||
1042 |
isJavaClassType |
|
1043 |
||
1044 |
^false |
|
1045 |
||
1046 |
"Created: / 11-02-2011 / 08:08:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1047 |
! ! |
|
1532 | 1048 |
|
752 | 1049 |
!Object class methodsFor:'queries'! |
1050 |
||
1051 |
isJavaPrimitiveType |
|
1052 |
||
1053 |
^false |
|
1054 |
||
1055 |
"Created: / 20-12-2010 / 21:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1056 |
! ! |
|
1532 | 1057 |
|
752 | 1058 |
!Object class methodsFor:'queries'! |
1059 |
||
1060 |
isJavaReferenceType |
|
1061 |
||
1062 |
^false |
|
1063 |
||
1064 |
"Created: / 20-12-2010 / 21:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1065 |
! ! |
|
1532 | 1066 |
|
752 | 1067 |
!Object class methodsFor:'queries'! |
1068 |
||
1069 |
isJavaType |
|
1070 |
||
1071 |
^false |
|
1072 |
||
1073 |
"Created: / 20-12-2010 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1074 |
! ! |
|
1532 | 1075 |
|
1076 |
!Process methodsFor:'Java protocol'! |
|
1077 |
||
1078 |
clearInterrupted |
|
1079 |
JavaVM threadInterrupts at: self put: false. |
|
1080 |
||
1081 |
"Created: / 30-11-2011 / 10:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1082 |
! ! |
|
1083 |
||
1084 |
!Process methodsFor:'Java protocol'! |
|
1085 |
||
1086 |
isInterrupted |
|
1087 |
||
1088 |
^ JavaVM threadInterrupts at: self |
|
1089 |
ifAbsent: [ JavaVM threadInterrupts at: self put: false. ] |
|
1090 |
||
1091 |
"Created: / 30-11-2011 / 12:12:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1092 |
! ! |
|
1093 |
||
1094 |
!Process methodsFor:'queries'! |
|
1095 |
||
1096 |
isSleeping |
|
1097 |
"return true, iff the receiver is sleeping on Delay" |
|
1098 |
||
1099 |
^ (state == #sleep) |
|
1100 |
||
1101 |
"Created: / 30-11-2011 / 13:35:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1102 |
! ! |
|
1103 |
||
1104 |
!Process methodsFor:'queries'! |
|
1105 |
||
1106 |
isWaiting |
|
1107 |
"return true, iff the receiver is waiting on semaphore or something" |
|
1108 |
||
1109 |
^ (state == #wait) |
|
1110 |
||
1111 |
"Created: / 20-11-2011 / 20:55:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1112 |
! ! |
|
1113 |
||
1114 |
!Process methodsFor:'Java protocol'! |
|
1115 |
||
1116 |
javaInterrupt |
|
1117 |
self isWaiting ifTrue: [ |
|
1118 |
self |
|
1119 |
interruptWith: [ |
|
1120 |
JavaVM |
|
1121 |
throwInterruptedException: 'thread has been interrupted during wait'. |
|
1122 |
self terminate |
|
1123 |
] |
|
1124 |
] ifFalse: [ |
|
1125 |
self isSleeping ifTrue: [ |
|
1126 |
||
1127 |
self |
|
1128 |
interruptWith: [ |
|
1129 |
JavaVM |
|
1130 |
throwInterruptedException: 'thread has been interrupted during sleep'. |
|
1131 |
self terminate |
|
1132 |
] |
|
1133 |
] ifFalse: [ self setInterrupted. ] |
|
1134 |
] |
|
1135 |
||
1136 |
"Created: / 30-11-2011 / 13:35:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1137 |
! ! |
|
1138 |
||
1139 |
!Process methodsFor:'Java protocol'! |
|
1140 |
||
1141 |
setInterrupted |
|
1142 |
||
1143 |
JavaVM threadInterrupts at: self put: true. |
|
1144 |
||
1145 |
"Created: / 30-11-2011 / 10:44:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1146 |
! ! |
|
1147 |
||
1148 |
!ProgrammingLanguage methodsFor:'testing'! |
|
1149 |
||
1150 |
isGroovy |
|
1151 |
"true iff this is a Groovy language" |
|
1152 |
||
1153 |
^ false |
|
1154 |
||
1155 |
"Created: / 13-04-2012 / 17:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1156 |
! ! |
|
1157 |
||
1158 |
!ProgrammingLanguage methodsFor:'testing'! |
|
1159 |
||
1160 |
isJavaLike |
|
1161 |
"true if receiver is kind of Java language (based on Java)" |
|
1162 |
||
1163 |
^ false |
|
1164 |
||
1165 |
"Created: / 13-04-2012 / 17:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1166 |
! ! |
|
1167 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1168 |
!ProjectDefinition class methodsFor:'description - java'! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1169 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1170 |
javaClassPath |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1171 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1172 |
"Defines a Java class path containing java classes/jars |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1173 |
required by this package" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1174 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1175 |
^#() |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1176 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1177 |
"Created: / 13-12-2011 / 23:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1178 |
! ! |
1532 | 1179 |
|
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1180 |
!ProjectDefinition class methodsFor:'description - java'! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1181 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1182 |
javaSourcePath |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1183 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1184 |
"Defines paths to Java source files (for packages that |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1185 |
contains Java code" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1186 |
^#() |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1187 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1188 |
"Created: / 13-12-2011 / 23:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1263
diff
changeset
|
1189 |
! ! |
1532 | 1190 |
|
1191 |
!Set methodsFor:'javaProtocol'! |
|
1192 |
||
1193 |
java__contains:anObject |
|
1194 |
^ self contains: [:el | anObject = el ] |
|
1195 |
! ! |
|
1196 |
||
752 | 1197 |
!ShortFloat class methodsFor:'queries'! |
1198 |
||
1199 |
isJavaPrimitiveType |
|
1200 |
||
1201 |
^true |
|
1202 |
||
1203 |
"Created: / 06-02-2011 / 17:21:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1204 |
! ! |
|
1532 | 1205 |
|
752 | 1206 |
!ShortFloat class methodsFor:'accessing'! |
1207 |
||
851 | 1208 |
javaArrayClass |
1209 |
^ FloatArray |
|
1210 |
||
1211 |
"Created: / 11-02-2011 / 10:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1212 |
! ! |
|
1532 | 1213 |
|
917 | 1214 |
!ShortFloat class methodsFor:'autoboxing support'! |
1215 |
||
1159 | 1216 |
javaBox: anObject |
917 | 1217 |
| wrapper | |
1218 |
||
1033 | 1219 |
wrapper := (JavaVM classForName: 'java.lang.Float') new. |
917 | 1220 |
wrapper perform: #'<init>(F)V' with: anObject. |
1033 | 1221 |
^ wrapper |
917 | 1222 |
|
1223 |
"Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1224 |
! ! |
|
1532 | 1225 |
|
851 | 1226 |
!ShortFloat class methodsFor:'accessing'! |
1227 |
||
752 | 1228 |
javaName |
1229 |
||
1230 |
^'float'. |
|
1231 |
||
1232 |
"Modified: / 25-02-2011 / 18:59:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1233 |
! ! |
|
1532 | 1234 |
|
1386 | 1235 |
!ShortFloat class methodsFor:'accessing'! |
1236 |
||
1237 |
javaWrapperClass |
|
1238 |
^(Java classForName: 'java.lang.Float') |
|
1239 |
||
1240 |
"Created: / 24-02-2012 / 19:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1241 |
! ! |
|
1532 | 1242 |
|
866 | 1243 |
!SignedIntegerArray class methodsFor:'testing'! |
1244 |
||
1245 |
isInterface |
|
1246 |
||
1247 |
^false |
|
1248 |
! ! |
|
1532 | 1249 |
|
866 | 1250 |
!SignedIntegerArray class methodsFor:'queries'! |
1251 |
||
1252 |
isJavaArrayClass |
|
1253 |
||
1254 |
^true |
|
1255 |
||
1256 |
"Created: / 06-02-2011 / 15:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1257 |
! ! |
|
1532 | 1258 |
|
905 | 1259 |
!SignedIntegerArray class methodsFor:'accessing-java'! |
1260 |
||
1261 |
javaArrayClass |
|
1262 |
||
1263 |
^JavaArray javaArrayClassFor: SignedIntegerArray |
|
1264 |
||
1265 |
"Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1266 |
"Modified: / 10-08-2011 / 22:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1267 |
! ! |
|
1532 | 1268 |
|
866 | 1269 |
!SignedIntegerArray class methodsFor:'accessing'! |
1270 |
||
1271 |
javaComponentClass |
|
1272 |
||
1273 |
^ Integer |
|
1274 |
||
1275 |
"Created: / 25-06-2011 / 08:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1276 |
! ! |
|
1532 | 1277 |
|
866 | 1278 |
!SignedIntegerArray class methodsFor:'accessing'! |
1279 |
||
1280 |
javaName |
|
1281 |
||
1282 |
^'[I'. |
|
1283 |
||
1284 |
"Modified: / 25-02-2011 / 19:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1285 |
! ! |
|
1532 | 1286 |
|
866 | 1287 |
!SignedLongIntegerArray class methodsFor:'testing'! |
1288 |
||
1289 |
isInterface |
|
1290 |
||
1291 |
^false |
|
1292 |
! ! |
|
1532 | 1293 |
|
866 | 1294 |
!SignedLongIntegerArray class methodsFor:'queries'! |
1295 |
||
1296 |
isJavaArrayClass |
|
1297 |
||
1298 |
^true |
|
1299 |
||
1300 |
"Created: / 20-12-2010 / 22:47:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1301 |
! ! |
|
1532 | 1302 |
|
866 | 1303 |
!SignedLongIntegerArray class methodsFor:'queries'! |
1304 |
||
1305 |
isJavaReferenceType |
|
1306 |
||
1307 |
"Java arrays are reference types" |
|
1308 |
^true |
|
1309 |
||
1310 |
"Created: / 20-12-2010 / 22:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1311 |
! ! |
|
1532 | 1312 |
|
927 | 1313 |
!SignedLongIntegerArray class methodsFor:'accessing-java'! |
1314 |
||
1315 |
javaArrayClass |
|
1316 |
||
1317 |
^JavaArray javaArrayClassFor: SignedLongIntegerArray |
|
1318 |
||
1319 |
"Modified: / 10-08-2011 / 22:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1320 |
"Created: / 26-08-2011 / 18:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1321 |
! ! |
|
1532 | 1322 |
|
866 | 1323 |
!SignedLongIntegerArray class methodsFor:'accessing'! |
1324 |
||
1325 |
javaComponentClass |
|
1326 |
||
1327 |
^LargeInteger |
|
1328 |
||
1329 |
"Modified: / 25-06-2011 / 08:38:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1330 |
! ! |
|
1532 | 1331 |
|
866 | 1332 |
!SignedLongIntegerArray class methodsFor:'accessing'! |
1333 |
||
1334 |
javaName |
|
1335 |
||
1336 |
^'[J'. |
|
1337 |
||
1338 |
"Modified: / 25-02-2011 / 19:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1339 |
! ! |
|
1532 | 1340 |
|
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1341 |
!SignedWordArray class methodsFor:'queries'! |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1342 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1343 |
isJavaArrayClass |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1344 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1345 |
^true |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1346 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1347 |
"Created: / 20-12-2010 / 22:47:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1348 |
! ! |
1532 | 1349 |
|
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1350 |
!SignedWordArray class methodsFor:'queries'! |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1351 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1352 |
isJavaReferenceType |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1353 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1354 |
"Java arrays are reference types" |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1355 |
^true |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1356 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1357 |
"Created: / 20-12-2010 / 22:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1358 |
! ! |
1532 | 1359 |
|
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1360 |
!SignedWordArray class methodsFor:'accessing'! |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1361 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1362 |
javaComponentClass |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1363 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1364 |
^JavaShort |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1365 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1366 |
"Modified: / 24-02-2012 / 17:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1367 |
! ! |
1532 | 1368 |
|
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1369 |
!SignedWordArray class methodsFor:'accessing'! |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1370 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1371 |
javaName |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1372 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1373 |
^'[S'. |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1374 |
|
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1375 |
"Modified: / 24-02-2012 / 17:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1376
diff
changeset
|
1376 |
! ! |
1532 | 1377 |
|
1378 |
!SmallInteger methodsFor:'autoboxing'! |
|
1379 |
||
1380 |
javaUnwrapFrom: javaType |
|
1381 |
javaType = #boolean ifTrue: [ |
|
1382 |
^ self = 1 |
|
1383 |
]. |
|
1384 |
^ self |
|
1385 |
||
1386 |
"Created: / 30-12-2011 / 15:22:52 / kursjan <kursjan@fit.cvut.cz>" |
|
1387 |
! ! |
|
1388 |
||
1389 |
!String methodsFor:'converting'! |
|
1390 |
||
1391 |
asArrayOfSubstringsSeparatedBy:aSeparator |
|
1392 |
"Modified version of asArrayOfSubstrings" |
|
1393 |
||
1394 |
|substrings start end| |
|
1395 |
||
1396 |
substrings := OrderedCollection new. |
|
1397 |
start := 1. |
|
1398 |
[start <= self size] whileTrue:[ |
|
1399 |
(self at:start) = aSeparator ifFalse:[ |
|
1400 |
end := start + 1. |
|
1401 |
[ |
|
1402 |
end <= self size and:[(self at:end) ~= aSeparator] |
|
1403 |
] whileTrue:[end := end + 1]. |
|
1404 |
substrings add:(self copyFrom:start to:end - 1). |
|
1405 |
start := end - 1 |
|
1406 |
]. |
|
1407 |
start := start + 1 |
|
1408 |
]. |
|
1409 |
^ substrings asArray |
|
1410 |
||
1411 |
"Created: / 07-02-2011 / 11:18:03 / Marcel Hlopko <hlopik@gmail.com>" |
|
1412 |
"Modified: / 08-02-2011 / 01:08:15 / Marcel Hlopko <hlopik@gmail.com>" |
|
1413 |
! ! |
|
1414 |
||
752 | 1415 |
!UndefinedObject class methodsFor:'queries'! |
1416 |
||
1417 |
isJavaPrimitiveType |
|
1418 |
||
1419 |
"void" |
|
1420 |
||
1421 |
^true |
|
1422 |
||
1423 |
"Created: / 21-12-2010 / 22:52:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1424 |
! ! |
|
1532 | 1425 |
|
752 | 1426 |
!UndefinedObject class methodsFor:'accessing'! |
1427 |
||
1428 |
javaName |
|
1429 |
||
1430 |
^'void'. |
|
1431 |
||
1432 |
"Modified: / 25-02-2011 / 18:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1433 |
! ! |
|
1532 | 1434 |
|
1570 | 1435 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1436 |
|
1437 |
javaClassPath |
|
1438 |
"Return the Java user-defined class path encoded as literal array" |
|
1439 |
||
1440 |
^ self at:#javaClassPath ifAbsent:[#()]. |
|
1441 |
||
1442 |
" |
|
1443 |
UserPreferences current javaClassPath |
|
1444 |
UserPreferences current javaClassPath: #openJDK7 |
|
1445 |
||
1446 |
Java classPath |
|
1447 |
" |
|
1448 |
||
1449 |
"Created: / 27-07-2012 / 12:52:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1450 |
! ! |
|
1451 |
||
1570 | 1452 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1453 |
|
1454 |
javaClassPath: literalArrayEncoding |
|
1455 |
"Sets the Java user-defined class path as literalArrayEncoding of a collection |
|
1456 |
of JavaPathElements" |
|
1457 |
||
1458 |
self at:#javaClassPath put: literalArrayEncoding. |
|
1459 |
(Java notNil and:[thisContext sender receiver == Java]) ifFalse:[ |
|
1460 |
| classPath | |
|
1461 |
classPath := literalArrayEncoding decodeAsLiteralArray. |
|
1462 |
Java classPath: classPath. |
|
1463 |
]. |
|
1464 |
||
1465 |
||
1466 |
" |
|
1467 |
UserPreferences current javaClassPath |
|
1468 |
UserPreferences current javaClassPath: #openJDK7 |
|
1469 |
||
1470 |
Java classPath |
|
1471 |
" |
|
1472 |
||
1473 |
"Created: / 27-07-2012 / 12:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1474 |
! ! |
|
1475 |
||
1570 | 1476 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1477 |
|
1588 | 1478 |
javaClassPathDecoded |
1479 |
"Return the Java user-defined class path (a collection of JavaPathElement)" |
|
1480 |
||
1481 |
^ self javaClassPath decodeAsLiteralArray |
|
1482 |
||
1483 |
" |
|
1484 |
UserPreferences current javaClassPathDecoded |
|
1485 |
UserPreferences current javaClassPath |
|
1486 |
||
1487 |
Java classPath |
|
1488 |
" |
|
1489 |
||
1490 |
"Created: / 02-08-2012 / 09:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1491 |
! ! |
|
1492 |
||
1493 |
!UserPreferences methodsFor:'accessing-java'! |
|
1494 |
||
1557 | 1495 |
javaRelease |
1496 |
"Return the Java release according to the preferences |
|
1497 |
or nil, if not set" |
|
1498 |
||
1499 |
| rel sel | |
|
1500 |
sel := self javaReleaseSelector. |
|
1501 |
sel notNil ifTrue:[ |
|
1502 |
rel := JavaRelease perform: sel asSymbol ifNotUnderstood:[nil] |
|
1503 |
]. |
|
1504 |
^rel |
|
1505 |
||
1506 |
"Created: / 27-07-2012 / 10:12:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1507 |
! ! |
|
1508 |
||
1570 | 1509 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1510 |
|
1511 |
javaReleaseSelector |
|
1512 |
^ self at:#javaReleaseSelector ifAbsent:[nil]. |
|
1513 |
||
1514 |
" |
|
1515 |
UserPreferences current javaReleaseSelector |
|
1516 |
UserPreferences current javaReleaseSelector: #openJDK6 |
|
1517 |
UserPreferences current javaReleaseSelector: nil |
|
1518 |
||
1519 |
Java release |
|
1520 |
" |
|
1521 |
||
1522 |
"Created: / 27-07-2012 / 10:02:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1523 |
! ! |
|
1524 |
||
1570 | 1525 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1526 |
|
1527 |
javaReleaseSelector: name |
|
1528 |
"Sets the Java release to use. selector must be one of |
|
1529 |
releases defined in JavaRelease, protocol 'instance creation'" |
|
1530 |
||
1531 |
self at:#javaReleaseSelector put: name. |
|
1532 |
Java notNil ifTrue:[ |
|
1533 |
Java reinitializeRelease |
|
1534 |
]. |
|
1535 |
||
1536 |
||
1537 |
" |
|
1538 |
UserPreferences current javaReleaseSelector |
|
1539 |
UserPreferences current javaReleaseSelector: #openJDK7 |
|
1540 |
UserPreferences current javaReleaseSelector: nil |
|
1541 |
||
1542 |
Java release |
|
1543 |
Java release:nil |
|
1544 |
||
1545 |
Java reinitializeRelease |
|
1546 |
" |
|
1547 |
||
1548 |
"Created: / 27-07-2012 / 10:02:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1549 |
! ! |
|
1550 |
||
1570 | 1551 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1552 |
|
1553 |
javaSourcePath |
|
1554 |
"Return the Java user-defined source path encoded as literal array" |
|
1555 |
||
1556 |
^ self at:#javaSourcePath ifAbsent:[#()]. |
|
1557 |
||
1558 |
" |
|
1559 |
UserPreferences current javaSourcePath |
|
1560 |
UserPreferences current javaSourcePath: #openJDK7 |
|
1561 |
||
1562 |
Java sourcePath |
|
1563 |
" |
|
1564 |
||
1565 |
"Created: / 27-07-2012 / 12:54:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1566 |
! ! |
|
1567 |
||
1570 | 1568 |
!UserPreferences methodsFor:'accessing-java'! |
1557 | 1569 |
|
1570 |
javaSourcePath: literalArrayEncoding |
|
1571 |
"Sets the Java user-defined source path as literalArrayEncoding of a collection |
|
1572 |
of JavaPathElements" |
|
1573 |
||
1574 |
self at:#javaSourcePath put: literalArrayEncoding. |
|
1575 |
(Java notNil and:[thisContext sender receiver == Java]) ifFalse:[ |
|
1576 |
| classPath | |
|
1577 |
classPath := literalArrayEncoding decodeAsLiteralArray. |
|
1578 |
Java sourceDirectories: classPath. |
|
1579 |
]. |
|
1580 |
||
1581 |
||
1582 |
" |
|
1583 |
UserPreferences current javaClassPath |
|
1584 |
UserPreferences current javaClassPath: #openJDK7 |
|
1585 |
||
1586 |
Java sourceDirectories |
|
1587 |
" |
|
1588 |
||
1589 |
"Created: / 27-07-2012 / 12:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1590 |
! ! |
|
1591 |
||
1588 | 1592 |
!UserPreferences methodsFor:'accessing-java'! |
1593 |
||
1594 |
javaSourcePathDecoded |
|
1595 |
"Return the Java user-defined source path (a collection of JavaPathElement)" |
|
1596 |
||
1597 |
^ self javaSourcePath decodeAsLiteralArray |
|
1598 |
||
1599 |
" |
|
1600 |
UserPreferences current javaSourcePathDecoded |
|
1601 |
UserPreferences current javaSourcePath |
|
1602 |
||
1603 |
Java sourceDirectories |
|
1604 |
" |
|
1605 |
||
1606 |
"Created: / 02-08-2012 / 09:44:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1607 |
! ! |
|
1608 |
||
1532 | 1609 |
!UserPreferences methodsFor:'accessing-java-devel'! |
1610 |
||
1611 |
javaTestsDirectory |
|
1612 |
^ self at: #javaTestsDirectory |
|
1613 |
ifAbsent: |
|
1614 |
[ | nm | |
|
1615 |
||
1616 |
nm := OperatingSystem getLoginName. |
|
1617 |
"Default path for Jan" |
|
1618 |
(nm = 'jv' and:[OperatingSystem isUNIXlike]) |
|
1619 |
ifTrue: |
|
1620 |
[ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/tests' ] |
|
1621 |
ifFalse: |
|
1622 |
[ "Default path for Jan (the other one :-)" |
|
1623 |
nm = 'jk' |
|
1624 |
ifTrue: [ 'path for Jan' ] |
|
1625 |
ifFalse: |
|
1626 |
[ "Default path for Marcel" |
|
1627 |
nm = 'm' |
|
1628 |
ifTrue: [ '/home/m/Projects/libjava/branches/jk_new_structure/tests' ] |
|
1629 |
ifFalse: |
|
1630 |
[ | "Look into package dir" p | |
|
1631 |
||
1632 |
(p := (Smalltalk getPackageDirectoryForPackage: 'stx:libjava') asFilename |
|
1633 |
/ 'tests') exists |
|
1634 |
ifTrue: [ p pathName ] |
|
1635 |
ifFalse: |
|
1636 |
[ | "Try the environment variable (used by Hudson)" p | |
|
1637 |
||
1638 |
(p := OperatingSystem getEnvironment: 'LIBJAVA_TESTS') notNil |
|
1639 |
ifTrue: [ p ] |
|
1640 |
ifFalse: |
|
1641 |
[ "No default, trigger an error" |
|
1642 |
self error: 'No tests path specified' ] ] ] ] ] ] |
|
1643 |
||
1644 |
" |
|
1645 |
UserPreferences current javaTestsDirectory" |
|
1646 |
||
1647 |
"Created: / 07-05-2011 / 17:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1648 |
"Modified: / 07-05-2011 / 20:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1649 |
"Modified: / 12-05-2011 / 15:54:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1650 |
! ! |
|
1651 |
||
1652 |
!UserPreferences methodsFor:'accessing-java-devel'! |
|
1653 |
||
1654 |
javaTestsDirectory: aStringOrFilename |
|
1655 |
||
1656 |
self at:#javaTestsDirectory put: aStringOrFilename asString. |
|
1657 |
||
1658 |
"Created: / 07-05-2011 / 17:45:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1659 |
! ! |
|
1660 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1661 |
!WordArray class methodsFor:'testing'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1662 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1663 |
isInterface |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1664 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1665 |
^false |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
774
diff
changeset
|
1666 |
! ! |
1532 | 1667 |
|
752 | 1668 |
!WordArray class methodsFor:'queries'! |
1669 |
||
1670 |
isJavaArrayClass |
|
1671 |
||
1672 |
^true |
|
1673 |
||
1674 |
"Created: / 20-12-2010 / 22:47:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1675 |
! ! |
|
1532 | 1676 |
|
752 | 1677 |
!WordArray class methodsFor:'queries'! |
1678 |
||
1679 |
isJavaReferenceType |
|
1680 |
||
1681 |
"Java arrays are reference types" |
|
1682 |
^true |
|
1683 |
||
1684 |
"Created: / 20-12-2010 / 22:30:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1685 |
! ! |
|
1532 | 1686 |
|
752 | 1687 |
!WordArray class methodsFor:'accessing-java'! |
1688 |
||
905 | 1689 |
javaArrayClass |
1690 |
||
1691 |
^JavaArray javaArrayClassFor: WordArray |
|
1692 |
||
1693 |
"Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1694 |
"Modified: / 10-08-2011 / 22:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1695 |
! ! |
|
1532 | 1696 |
|
905 | 1697 |
!WordArray class methodsFor:'accessing-java'! |
1698 |
||
752 | 1699 |
javaComponentClass |
1700 |
||
1159 | 1701 |
^JavaShort |
752 | 1702 |
|
1703 |
"Created: / 20-12-2010 / 22:13:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1704 |
! ! |
|
1532 | 1705 |
|
752 | 1706 |
!WordArray class methodsFor:'accessing'! |
1707 |
||
1708 |
javaName |
|
1225
30600ca8173c
ok now we enabled permissions and groovy maybe does not work :/
hlopkmar
parents:
1209
diff
changeset
|
1709 |
^ '[S'. |
752 | 1710 |
|
1225
30600ca8173c
ok now we enabled permissions and groovy maybe does not work :/
hlopkmar
parents:
1209
diff
changeset
|
1711 |
"Modified: / 06-12-2011 / 16:43:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1712 |
! ! |
1532 | 1713 |
|
1714 |
!WrappedMethod methodsFor:'accessing'! |
|
1715 |
||
1716 |
descriptor |
|
1717 |
"Returns descriptor object (for wrapped Java methods)" |
|
1718 |
||
1719 |
| orig | |
|
1720 |
orig := self originalMethod. |
|
1721 |
^(orig respondsTo: #descriptor) ifTrue:[ |
|
1722 |
orig descriptor |
|
1723 |
] ifFalse:[ |
|
1724 |
self doesNotUnderstand: (Message selector: #descriptor) |
|
1725 |
] |
|
1726 |
||
1727 |
"Created: / 16-12-2011 / 20:03:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1728 |
! ! |
|
1729 |
||
1730 |
!WrappedMethod methodsFor:'queries'! |
|
1731 |
||
1732 |
isAbstract |
|
1733 |
||
1734 |
^self originalMethod isAbstract. |
|
1735 |
||
1736 |
"Created: / 04-12-2011 / 11:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1737 |
! ! |
|
1738 |
||
1739 |
!ZipArchive methodsFor:'reading - java support'! |
|
1740 |
||
1741 |
nextBytes: bytesToRead of: zmember startingAt: pos into: b startingAt: off |
|
1742 |
||
1743 |
file position0Based: zmember fileStart + startOfArchive + pos. |
|
1744 |
^ file nextBytes: bytesToRead into: b startingAt: off. |
|
1745 |
||
1746 |
"Created: / 01-05-2011 / 16:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1747 |
! ! |
|
1748 |
||
1749 |
!stx_libjava class methodsFor:'documentation'! |
|
1750 |
||
1751 |
extensionsVersion_SVN |
|
1752 |
^ '$Id:: $' |
|
1753 |
! ! |