Source Code Cross Referenced for Double.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 primitive <code>double</code> as an object.
020:         */
021:        public final class Double extends Number implements  Comparable<Double> {
022:            public static final double MAX_VALUE = 1.7976931348623157e+308;
023:            public static final double MIN_VALUE = 4.9e-324;
024:            public static final double MIN_NORMAL = 2.2250738585072014e-308;
025:            public static final int MAX_EXPONENT = 1023;
026:            // ==Math.getExponent(Double.MAX_VALUE);
027:            public static final int MIN_EXPONENT = -1022;
028:            // ==Math.getExponent(Double.MIN_NORMAL);;
029:
030:            public static final double NaN = 0d / 0d;
031:            public static final double NEGATIVE_INFINITY = -1d / 0d;
032:            public static final double POSITIVE_INFINITY = 1d / 0d;
033:            public static final int SIZE = 64;
034:
035:            public static int compare(double x, double y) {
036:                if (x < y) {
037:                    return -1;
038:                } else if (x > y) {
039:                    return 1;
040:                } else {
041:                    return 0;
042:                }
043:            }
044:
045:            /**
046:             * @skip Here for shared implementation with Arrays.hashCode
047:             */
048:            public static int hashCode(double d) {
049:                return (int) d;
050:            }
051:
052:            public static native boolean isInfinite(double x) /*-{
053:               return !isFinite(x);
054:             }-*/;
055:
056:            public static native boolean isNaN(double x) /*-{
057:               return isNaN(x);
058:             }-*/;
059:
060:            public static double parseDouble(String s)
061:                    throws NumberFormatException {
062:                return __parseAndValidateDouble(s);
063:            }
064:
065:            public static String toString(double b) {
066:                return String.valueOf(b);
067:            }
068:
069:            public static Double valueOf(double d) {
070:                return new Double(d);
071:            }
072:
073:            public static Double valueOf(String s) throws NumberFormatException {
074:                return new Double(Double.parseDouble(s));
075:            }
076:
077:            private final transient double value;
078:
079:            public Double(double value) {
080:                this .value = value;
081:            }
082:
083:            public Double(String s) {
084:                value = parseDouble(s);
085:            }
086:
087:            @Override
088:            public byte byteValue() {
089:                return (byte) value;
090:            }
091:
092:            public int compareTo(Double b) {
093:                if (value < b.value) {
094:                    return -1;
095:                } else if (value > b.value) {
096:                    return 1;
097:                } else {
098:                    return 0;
099:                }
100:            }
101:
102:            @Override
103:            public double doubleValue() {
104:                return value;
105:            }
106:
107:            @Override
108:            public boolean equals(Object o) {
109:                return (o instanceof  Double) && (((Double) o).value == value);
110:            }
111:
112:            @Override
113:            public float floatValue() {
114:                return (float) value;
115:            }
116:
117:            /**
118:             * Performance caution: using Double objects as map keys is not recommended.
119:             * Using double values as keys is generally a bad idea due to difficulty
120:             * determining exact equality. In addition, there is no efficient JavaScript
121:             * equivalent of <code>doubleToIntBits</code>. As a result, this method
122:             * computes a hash code by truncating the whole number portion of the double,
123:             * which may lead to poor performance for certain value sets if Doubles are
124:             * used as keys in a {@link java.util.HashMap}.
125:             */
126:            @Override
127:            public int hashCode() {
128:                return hashCode(value);
129:            }
130:
131:            @Override
132:            public int intValue() {
133:                return (int) value;
134:            }
135:
136:            public boolean isInfinite() {
137:                return isInfinite(value);
138:            }
139:
140:            public boolean isNaN() {
141:                return isNaN(value);
142:            }
143:
144:            @Override
145:            public long longValue() {
146:                return (long) value;
147:            }
148:
149:            @Override
150:            public short shortValue() {
151:                return (short) value;
152:            }
153:
154:            @Override
155:            public String toString() {
156:                return toString(value);
157:            }
158:
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.