Source Code Cross Referenced for Float.java in  » Ajax » GWT » com » google » gwt » emul » java » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » GWT » com.google.gwt.emul.java.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package java.lang;
017:
018:        /**
019:         * Wraps a primitve <code>float</code> as an object.
020:         */
021:        public final class Float extends Number implements  Comparable<Float> {
022:            public static final float MAX_VALUE = 3.4028235e+38f;
023:            public static final float MIN_VALUE = 1.4e-45f;
024:            public static final float MAX_EXPONENT = 127;
025:            public static final float MIN_EXPONENT = -126;
026:            public static final float MIN_NORMAL = 1.1754943508222875E-38f;
027:            public static final float NaN = 0f / 0f;
028:            public static final float NEGATIVE_INFINITY = -1f / 0f;
029:            public static final float POSITIVE_INFINITY = 1f / 0f;
030:            public static final int SIZE = 32;
031:
032:            public static int compare(float x, float y) {
033:                if (x < y) {
034:                    return -1;
035:                } else if (x > y) {
036:                    return 1;
037:                } else {
038:                    return 0;
039:                }
040:            }
041:
042:            /**
043:             * @skip Here for shared implementation with Arrays.hashCode
044:             */
045:            public static int hashCode(float f) {
046:                return (int) f;
047:            }
048:
049:            public static native boolean isInfinite(float x) /*-{
050:               return !isFinite(x);
051:             }-*/;
052:
053:            public static native boolean isNaN(float x) /*-{
054:               return isNaN(x);
055:             }-*/;
056:
057:            public static float parseFloat(String s)
058:                    throws NumberFormatException {
059:                return (float) __parseAndValidateDouble(s);
060:            }
061:
062:            public static String toString(float b) {
063:                return String.valueOf(b);
064:            }
065:
066:            public static Float valueOf(float f) {
067:                return new Float(f);
068:            }
069:
070:            public static Float valueOf(String s) throws NumberFormatException {
071:                return new Float(Float.parseFloat(s));
072:            }
073:
074:            private final transient float value;
075:
076:            public Float(float value) {
077:                this .value = value;
078:            }
079:
080:            public Float(String s) {
081:                value = parseFloat(s);
082:            }
083:
084:            @Override
085:            public byte byteValue() {
086:                return (byte) value;
087:            }
088:
089:            public int compareTo(Float b) {
090:                if (value < b.value) {
091:                    return -1;
092:                } else if (value > b.value) {
093:                    return 1;
094:                } else {
095:                    return 0;
096:                }
097:            }
098:
099:            @Override
100:            public double doubleValue() {
101:                return value;
102:            }
103:
104:            @Override
105:            public boolean equals(Object o) {
106:                return (o instanceof  Float) && (((Float) o).value == value);
107:            }
108:
109:            @Override
110:            public float floatValue() {
111:                return value;
112:            }
113:
114:            /**
115:             * Performance caution: using Float objects as map keys is not recommended.
116:             * Using floating point values as keys is generally a bad idea due to
117:             * difficulty determining exact equality. In addition, there is no efficient
118:             * JavaScript equivalent of <code>floatToIntBits</code>. As a result, this
119:             * method computes a hash code by truncating the whole number portion of the
120:             * float, which may lead to poor performance for certain value sets if Floats
121:             * are used as keys in a {@link java.util.HashMap}.
122:             */
123:            @Override
124:            public int hashCode() {
125:                return hashCode(value);
126:            }
127:
128:            @Override
129:            public int intValue() {
130:                return (int) value;
131:            }
132:
133:            public boolean isInfinite() {
134:                return isInfinite(value);
135:            }
136:
137:            public boolean isNaN() {
138:                return isNaN(value);
139:            }
140:
141:            @Override
142:            public long longValue() {
143:                return (long) value;
144:            }
145:
146:            @Override
147:            public short shortValue() {
148:                return (short) value;
149:            }
150:
151:            @Override
152:            public String toString() {
153:                return toString(value);
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.