annotate base/src/java/lang/Float.d @ 120:536e43f63c81

Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661 ===D2=== * added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements used these templates to work with strict type storage rules of dmd-2.053 * com.ibm.icu now also compilable with D2, but not tested yet * small fixes Snippet288 - shared data is in TLS ===Phobos=== * fixed critical bugs in Phobos implemention completely incorrect segfault prone fromStringz (Linux's port ruthless killer) terrible, incorrect StringBuffer realization (StyledText killer) * fixed small bugs as well Snippet72 - misprint in the snippet * implemented missed functionality for Phobos ByteArrayOutputStream implemented (image loading available) formatting correctly works for all DWT's cases As a result, folowing snippets now works with Phobos (Snippet### - what is fixed): Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting Snippet48, 282 - crash on image loading Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText Snippet244 - hang-up ===Tango=== * few changes for the latest Tango trunc-r5661 * few small performance improvments ===General=== * implMissing-s for only one version changed to implMissingInTango/InPhobos * incorrect calls to Format in toString-s fixed * fixed loading \uXXXX characters in ResourceBundle * added good UTF-8 support for StyledText, TextLayout (Win32) and friends UTF functions revised and tested. It is now in java.nonstandard.*Utf modules StyledText and TextLayout (Win32) modules revised for UTF-8 support * removed small diferences in most identical files in *.swt.* folders *.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32 now 179 of 576 (~31%) files in *.swt.* folders are fully identical * Win32: snippets now have right subsystem, pretty icons and native system style controls * small fixes in snippets Snippet44 - it's not Snippet44 Snippet212 - functions work with different images and offsets arrays Win32: Snippet282 - crash on close if the button has an image Snippet293 - setGrayed is commented and others Win32: As a result, folowing snippets now works Snippet68 - color doesn't change Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above) Snippet193 - no tabel headers
author Denis Shelomovskij <verylonglogin.reg@gmail.com>
date Sat, 09 Jul 2011 15:50:20 +0300
parents e944a4cf537b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 module java.lang.Float;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 import java.lang.util;
2
712ffca654f3 Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
4 import java.lang.exceptions;
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
5 import java.lang.Number;
88
9e0ab372d5d8 Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents: 84
diff changeset
6 import java.lang.Class;
120
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
7 import java.lang.String;
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
8
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
9 version(Tango){
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
10 static import tango.text.convert.Float;
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
11 } else { // Phobos
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
12 static import std.conv;
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
13 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
15 class Float : Number {
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
16
120
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
17 public static float POSITIVE_INFINITY = float.infinity;
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
18 public static float NEGATIVE_INFINITY = -float.infinity;
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
19 public static float NaN = float.nan;
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 public static float MAX_VALUE = 3.4028235e+38f;
107
e944a4cf537b Updated to dmd 1.063 and Tango trunk.
Jacob Carlborg <doob@me.com>
parents: 88
diff changeset
21 public static float MIN_VALUE = float.min; //1.4e-45f
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 public static int SIZE = 32;
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
23 private float value;
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25 this( float value ){
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
26 super();
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
27 this.value = value;
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 this( String str ){
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
30 super();
120
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
31 this.value = parseFloat(str);
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 public static String toString( float value ){
120
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
34 return String_valueOf(value);
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 public static float parseFloat( String s ){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
37 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
38 try{
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
39 return tango.text.convert.Float.toFloat( s );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
40 }
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
41 catch( IllegalArgumentException e ){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
42 throw new NumberFormatException( e );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
43 }
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 2
diff changeset
44 } else { // Phobos
120
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
45 try{
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
46 return std.conv.to!(float)(s);
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
47 }
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
48 catch( std.conv.ConvException e ){
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
49 throw new NumberFormatException( e );
536e43f63c81 Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents: 107
diff changeset
50 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53
88
9e0ab372d5d8 Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents: 84
diff changeset
54 private static Class TYPE_;
9e0ab372d5d8 Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents: 84
diff changeset
55 public static Class TYPE(){
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
56 if( TYPE_ is null ){
88
9e0ab372d5d8 Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents: 84
diff changeset
57 TYPE_ = Class.fromType!(float);
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
58 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
59 return TYPE_;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
60 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
61
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
62 public byte byteValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
63 return cast(byte)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
64 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
65
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
66 public short shortValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
67 return cast(short)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
68 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
69
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
70 public int intValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
71 return cast(int)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
72 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
73
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
74 public long longValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
75 return cast(long)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
76 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
77
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
78 public float floatValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
79 return cast(float)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
80 }
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
81
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
82 public double doubleValue(){
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
83 return cast(double)value;
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
84 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 }
84
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
86
fcf926c91ca4 Added base classes
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
87