File tree Expand file tree Collapse file tree
sources/net.sf.j2s.java.core/j2score Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,11 +28,21 @@ this.valueOf = function () {
2828} , "String" ) ;
2929
3030Double . serialVersionUID = Double . prototype . serialVersionUID = - 9172774392245257468 ;
31- Double . MIN_VALUE = Double . prototype . MIN_VALUE = 3.4028235e+38 ;
32- Double . MAX_VALUE = Double . prototype . MAX_VALUE = 1.4e-45 ;
31+ Double . MIN_VALUE = Double . prototype . MIN_VALUE = 4.9e-324 ;
32+ Double . MAX_VALUE = Double . prototype . MAX_VALUE = 1.7976931348623157e+308 ;
3333Double . NEGATIVE_INFINITY = Number . NEGATIVE_INFINITY ;
3434Double . POSITIVE_INFINITY = Number . POSITIVE_INFINITY ;
3535Double . NaN = Number . NaN ;
36+ Clazz . defineMethod ( Double , "isNaN" ,
37+ function ( num ) {
38+ return isNaN ( num ) ;
39+ } , "Number" ) ;
40+ Double . isNaN = Double . prototype . isNaN ;
41+ Clazz . defineMethod ( Double , "isInfinite" ,
42+ function ( num ) {
43+ return ! isFinite ( num ) ;
44+ } , "Number" ) ;
45+ Double . isInfinite = Double . prototype . isInfinite ;
3646
3747Clazz . defineMethod ( Double , "parseDouble" ,
3848function ( s ) {
Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ Encoding.readUTF8 = function (str) {
2727 var charCode = str . charCodeAt ( i ) ;
2828 if ( charCode < 0x80 ) {
2929 arrs [ arrs . length ] = str . charAt ( i ) ;
30- } else if ( charCode > 0xc0 && charCode <= 0xe0 ) {
30+ } else if ( charCode > 0xc0 && charCode < 0xe0 ) {
3131 var c1 = charCode & 0x1f ;
3232 i ++ ;
3333 var c2 = str . charCodeAt ( i ) & 0x3f ;
3434 var c = ( c1 << 6 ) + c2 ;
3535 arrs [ arrs . length ] = String . fromCharCode ( c ) ;
36- } else if ( charCode > 0xe0 ) {
36+ } else if ( charCode >= 0xe0 ) {
3737 var c1 = charCode & 0x0f ;
3838 i ++ ;
3939 var c2 = str . charCodeAt ( i ) & 0x3f ;
@@ -66,7 +66,7 @@ Encoding.convert2UTF8 = function (str) {
6666 var charCode = str . charCodeAt ( i ) ;
6767 if ( charCode < 0x80 ) {
6868 arrs [ offset + i - startIdx ] = str . charAt ( i ) ;
69- } else if ( charCode < 0x07ff ) { //(charCode > 0xc0 && charCode < 0xe0) {
69+ } else if ( charCode <= 0x07ff ) { //(charCode > 0xc0 && charCode < 0xe0) {
7070 var c1 = 0xc0 + ( ( charCode & 0x07c0 ) >> 6 ) ;
7171 var c2 = 0x80 + ( charCode & 0x003f ) ;
7272 arrs [ offset + i - startIdx ] = String . fromCharCode ( c1 ) + String . fromCharCode ( c2 ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,12 @@ this.valueOf = function () {
2121} , "Number" ) ;
2222Clazz . makeConstructor ( Float ,
2323function ( s ) {
24- var value = Float . parseFloat ( s , 10 ) ;
24+ var value = null ;
25+ if ( s != null ) {
26+ value = Float . parseFloat ( s , 10 ) ;
27+ } else {
28+ value = 0 ;
29+ }
2530this . valueOf = function ( ) {
2631 return value ;
2732} ;
@@ -46,6 +51,11 @@ function (num) {
4651return isNaN ( num ) ;
4752} , "Number" ) ;
4853Float . isNaN = Float . prototype . isNaN ;
54+ Clazz . defineMethod ( Float , "isInfinite" ,
55+ function ( num ) {
56+ return ! isFinite ( num ) ;
57+ } , "Number" ) ;
58+ Float . isInfinite = Float . prototype . isInfinite ;
4959
5060Clazz . defineMethod ( Float , "equals" ,
5161function ( s ) {
Original file line number Diff line number Diff line change @@ -55,5 +55,14 @@ if(s == null || ! Clazz.instanceOf(s, Integer) ){
5555 return false ;
5656}
5757return s . valueOf ( ) == this . valueOf ( ) ;
58- } , "Object" ) ;
58+ } , "Object" ) ;
59+ Integer . toHexString = Integer . prototype . toHexString = function ( i ) {
60+ return i . toString ( 16 ) ;
61+ } ;
62+ Integer . toOctalString = Integer . prototype . toOctalString = function ( i ) {
63+ return i . toString ( 8 ) ;
64+ } ;
65+ Integer . toBinaryString = Integer . prototype . toBinaryString = function ( i ) {
66+ return i . toString ( 2 ) ;
67+ } ;
5968} ) ;
You can’t perform that action at this time.
0 commit comments