JavaClass.st
changeset 2104 1b6366474dbf
parent 2102 98d9603f9a7f
child 2106 34f1968f1ac9
equal deleted inserted replaced
2103:5987e2774a02 2104:1b6366474dbf
   319         ].
   319         ].
   320         ^ failBlock value:('cannot convert argument to ' , type) value:0
   320         ^ failBlock value:('cannot convert argument to ' , type) value:0
   321     ].
   321     ].
   322 
   322 
   323     (type == #float) ifTrue:[
   323     (type == #float) ifTrue:[
   324         arg isReal ifTrue:[
   324         arg isLimitedPrecisionReal ifTrue:[
   325             ^ arg asShortFloat
   325             ^ arg asShortFloat
   326         ].
   326         ].
   327         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   327         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   328     ].
   328     ].
   329 
   329 
   330     (type == 'java.lang.Float') ifTrue:[
   330     (type = 'java.lang.Float') ifTrue:[
   331         arg isReal ifTrue:[
   331         arg isLimitedPrecisionReal ifTrue:[
   332             f := (Java at:'java.lang.Float') new.
   332             f := (Java at:'java.lang.Float') new.
   333             f perform:#'<init>(F)V' with:(arg asShortFloat).
   333             f perform:#'<init>(F)V' with:(arg asShortFloat).
   334 self halt.
   334 self halt.
   335             ^ f.
   335             ^ f.
   336         ].
   336         ].
   337         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   337         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   338     ].
   338     ].
   339     (type == 'java.lang.Double') ifTrue:[
   339     (type = 'java.lang.Double') ifTrue:[
   340         arg isReal ifTrue:[
   340         arg isLimitedPrecisionReal ifTrue:[
   341             f := (Java at:'java.lang.Double') new.
   341             f := (Java at:'java.lang.Double') new.
   342             f perform:#'<init>(D)V' with:(arg asFloat).
   342             f perform:#'<init>(D)V' with:(arg asFloat).
   343 self halt.
   343 self halt.
   344             ^ f.
   344             ^ f.
   345         ].
   345         ].
   346         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   346         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   347     ].
   347     ].
   348 
   348 
   349     (type == #double) ifTrue:[
   349     (type == #double) ifTrue:[
   350         arg isReal ifTrue:[
   350         arg isLimitedPrecisionReal ifTrue:[
   351             ^ arg asFloat
   351             ^ arg asFloat
   352         ].
   352         ].
   353         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   353         ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
   354     ].
   354     ].
   355 
   355 
   420     ].
   420     ].
   421 self halt.
   421 self halt.
   422     ^ failBlock value:('cannot convert argument to ' , type) value:failValue
   422     ^ failBlock value:('cannot convert argument to ' , type) value:failValue
   423 
   423 
   424     "Created: / 6.11.1998 / 00:46:19 / cg"
   424     "Created: / 6.11.1998 / 00:46:19 / cg"
   425     "Modified: / 28.1.1999 / 17:55:17 / cg"
   425     "Modified: / 6.11.2001 / 13:28:29 / cg"
   426 !
   426 !
   427 
   427 
   428 convertToSmalltalk:jObj type:type 
   428 convertToSmalltalk:jObj type:type 
   429     "given a java return value, convert to a smalltalk object as appropriate.
   429     "given a java return value, convert to a smalltalk object as appropriate.
   430      Currently, only a few types are converted."
   430      Currently, only a few types are converted."
   582     typeChar := s next.
   582     typeChar := s next.
   583     ^ InitialValuePerType at:typeChar ifAbsent:nil.
   583     ^ InitialValuePerType at:typeChar ifAbsent:nil.
   584 ! !
   584 ! !
   585 
   585 
   586 !JavaClass class methodsFor:'special'!
   586 !JavaClass class methodsFor:'special'!
       
   587 
       
   588 flushClassesInitOrder
       
   589     OrderOfClassInits := nil
       
   590 
       
   591     "Created: / 6.11.2001 / 09:49:49 / cg"
       
   592 !
   587 
   593 
   588 orderOfClassInits
   594 orderOfClassInits
   589     ^ OrderOfClassInits
   595     ^ OrderOfClassInits
   590 
   596 
   591     "Created: / 12.11.1998 / 15:35:57 / cg"
   597     "Created: / 12.11.1998 / 15:35:57 / cg"
  1848 ! !
  1854 ! !
  1849 
  1855 
  1850 !JavaClass class methodsFor:'documentation'!
  1856 !JavaClass class methodsFor:'documentation'!
  1851 
  1857 
  1852 version
  1858 version
  1853     ^ '$Header: /cvs/stx/stx/libjava/JavaClass.st,v 1.121 2001-04-24 22:16:03 cg Exp $'
  1859     ^ '$Header: /cvs/stx/stx/libjava/JavaClass.st,v 1.122 2001-11-06 13:22:09 cg Exp $'
  1854 ! !
  1860 ! !
  1855 JavaClass initialize!
  1861 JavaClass initialize!