comparison java/src/java/lang/Byte.d @ 21:9b96950f2c3c

the 'java' tree compiles on both D1-Tango and D2-Phobos
author Frank Benoit <benoit@tionex.de>
date Thu, 19 Mar 2009 20:38:55 +0100
parents 712ffca654f3
children
comparison
equal deleted inserted replaced
20:dccb717aa902 21:9b96950f2c3c
1 module java.lang.Byte; 1 module java.lang.Byte;
2 2
3 import java.lang.util; 3 import java.lang.util;
4 import java.lang.exceptions; 4 import java.lang.exceptions;
5 5
6 version(Tango){
7 static import tango.text.convert.Integer;
8 } else { // Phobos
9 }
6 class Byte : ValueWrapperT!(byte) { 10 class Byte : ValueWrapperT!(byte) {
7 public static byte parseByte( String s ){ 11 public static byte parseByte( String s ){
8 try{ 12 version(Tango){
9 int res = tango.text.convert.Integer.parse( s ); 13 try{
10 if( res < byte.min || res > byte.max ){ 14 int res = tango.text.convert.Integer.parse( s );
11 throw new NumberFormatException( "out of range" ); 15 if( res < byte.min || res > byte.max ){
16 throw new NumberFormatException( "out of range" );
17 }
18 return res;
12 } 19 }
13 return res; 20 catch( IllegalArgumentException e ){
14 } 21 throw new NumberFormatException( e );
15 catch( IllegalArgumentException e ){ 22 }
16 throw new NumberFormatException( e ); 23 } else { // Phobos
24 implMissing( __FILE__, __LINE__);
25 return 0;
17 } 26 }
18 } 27 }
19 this( byte value ){ 28 this( byte value ){
20 super( value ); 29 super( value );
21 } 30 }
22 31
23 public static String toString( byte i ){ 32 public static String toString( byte i ){
24 return tango.text.convert.Integer.toString(i); 33 return String_valueOf(i);
25 } 34 }
26 35
27 } 36 }
28 alias Byte ValueWrapperByte; 37 alias Byte ValueWrapperByte;
29 38