Mercurial > projects > dwt2
comparison base/src/java/lang/Byte.d @ 84:fcf926c91ca4
Added base classes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 18 Apr 2009 09:25:29 +0200 |
parents | 1bf55a6eb092 |
children | 9e0ab372d5d8 |
comparison
equal
deleted
inserted
replaced
83:0628aaa2996c | 84:fcf926c91ca4 |
---|---|
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 import java.lang.Number; | |
5 | 6 |
6 version(Tango){ | 7 version(Tango){ |
7 static import tango.text.convert.Integer; | 8 static import tango.text.convert.Integer; |
8 } else { // Phobos | 9 } else { // Phobos |
9 } | 10 } |
10 class Byte : ValueWrapperT!(byte) { | 11 class Byte : Number { |
12 public static const byte MIN_VALUE = byte.min; | |
13 public static const byte MAX_VALUE = byte.max; | |
14 private byte value; | |
15 | |
11 public static byte parseByte( String s ){ | 16 public static byte parseByte( String s ){ |
12 version(Tango){ | 17 version(Tango){ |
13 try{ | 18 try{ |
14 int res = tango.text.convert.Integer.parse( s ); | 19 int res = tango.text.convert.Integer.parse( s ); |
15 if( res < byte.min || res > byte.max ){ | 20 if( res < byte.min || res > byte.max ){ |
24 implMissing( __FILE__, __LINE__); | 29 implMissing( __FILE__, __LINE__); |
25 return 0; | 30 return 0; |
26 } | 31 } |
27 } | 32 } |
28 this( byte value ){ | 33 this( byte value ){ |
29 super( value ); | 34 super(); |
35 this.value = value; | |
30 } | 36 } |
31 | 37 |
32 public static String toString( byte i ){ | 38 public static String toString( byte i ){ |
33 return String_valueOf(i); | 39 return String_valueOf(i); |
34 } | 40 } |
35 | 41 |
42 private static TypeInfo TYPE_; | |
43 public static TypeInfo TYPE(){ | |
44 if( TYPE_ is null ){ | |
45 TYPE_ = typeid(byte); | |
46 } | |
47 return TYPE_; | |
48 } | |
49 | |
50 byte byteValue(){ return value; } | |
51 double doubleValue(){ return value; } | |
52 float floatValue(){ return value; } | |
53 int intValue(){ return value; } | |
54 long longValue(){ return value; } | |
55 short shortValue(){ return value; } | |
36 } | 56 } |
37 alias Byte ValueWrapperByte; | 57 alias Byte ValueWrapperByte; |
38 | 58 |
59 |