Java Doc for NumberMath.java in  » Scripting » groovy-1.0 » org » codehaus » groovy » runtime » typehandling » 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 » Scripting » groovy 1.0 » org.codehaus.groovy.runtime.typehandling 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.groovy.runtime.typehandling.NumberMath

All known Subclasses:   org.codehaus.groovy.runtime.typehandling.BigIntegerMath,  org.codehaus.groovy.runtime.typehandling.FloatingPointMath,  org.codehaus.groovy.runtime.typehandling.BigDecimalMath,  org.codehaus.groovy.runtime.typehandling.LongMath,  org.codehaus.groovy.runtime.typehandling.IntegerMath,
NumberMath
abstract public class NumberMath extends Object (Code)
Stateless objects used to perform math on the various Number subclasses. Instances are required so that polymorphic calls work properly, but each subclass creates a singleton instance to minimize garbage. All methods must be thread-safe. The design goals of this class are as follows:
  1. Support a 'least surprising' math model to scripting language users. This means that exact, or decimal math should be used for default calculations. This scheme assumes that by default, groovy literals with decimal points are instantiated as BigDecimal objects rather than binary floating points (Float, Double).
  2. Do not force the appearance of exactness on a number that is by definition not guaranteed to be exact. In particular this means that if an operand in a NumberMath operation is a binary floating point number, ensure that the result remains a binary floating point number (i.e. never automatically promote a binary floating point number to a BigDecimal). This has the effect of preserving the expectations of binary floating point users and helps performance.
  3. Provide an implementation that is as close as practical to the Java 1.5 BigDecimal math model which implements precision based floating point decimal math (ANSI X3.274-1996 and ANSI X3.274-1996/AM 1-2000 (section 7.4).

author:
   Steve Goetze




Method Summary
public static  Numberabs(Number number)
    
abstract protected  NumberabsImpl(Number number)
    
public static  Numberadd(Number left, Number right)
    
abstract protected  NumberaddImpl(Number left, Number right)
    
public static  Numberand(Number left, Number right)
    
protected  NumberandImpl(Number left, Number right)
    
public static  intcompareTo(Number left, Number right)
    
abstract protected  intcompareToImpl(Number left, Number right)
    
protected  UnsupportedOperationExceptioncreateUnsupportedException(String operation, Number left)
    
public static  Numberdivide(Number left, Number right)
    
abstract protected  NumberdivideImpl(Number left, Number right)
    
public static  Numberintdiv(Number left, Number right)
    
protected  NumberintdivImpl(Number left, Number right)
    
public static  booleanisBigDecimal(Number number)
    
public static  booleanisBigInteger(Number number)
    
public static  booleanisFloatingPoint(Number number)
    
public static  booleanisInteger(Number number)
    
public static  booleanisLong(Number number)
    
public static  NumberleftShift(Number left, Number right)
     For this operation, consider the operands independently.
protected  NumberleftShiftImpl(Number left, Number right)
    
public static  Numbermod(Number left, Number right)
    
protected  NumbermodImpl(Number left, Number right)
    
public static  Numbermultiply(Number left, Number right)
    
abstract protected  NumbermultiplyImpl(Number left, Number right)
    
public static  Numbernegate(Number left)
    
abstract protected  NumbernegateImpl(Number left)
    
public static  Numberor(Number left, Number right)
    
protected  NumberorImpl(Number left, Number right)
    
public static  NumberrightShift(Number left, Number right)
     For this operation, consider the operands independently.
protected  NumberrightShiftImpl(Number left, Number right)
    
public static  NumberrightShiftUnsigned(Number left, Number right)
     For this operation, consider the operands independently.
protected  NumberrightShiftUnsignedImpl(Number left, Number right)
    
public static  Numbersubtract(Number left, Number right)
    
abstract protected  NumbersubtractImpl(Number left, Number right)
    
public static  BigDecimaltoBigDecimal(Number n)
    
public static  BigIntegertoBigInteger(Number n)
    
public static  Numberxor(Number left, Number right)
    
protected  NumberxorImpl(Number left, Number right)
    



Method Detail
abs
public static Number abs(Number number)(Code)



absImpl
abstract protected Number absImpl(Number number)(Code)



add
public static Number add(Number left, Number right)(Code)



addImpl
abstract protected Number addImpl(Number left, Number right)(Code)



and
public static Number and(Number left, Number right)(Code)



andImpl
protected Number andImpl(Number left, Number right)(Code)



compareTo
public static int compareTo(Number left, Number right)(Code)



compareToImpl
abstract protected int compareToImpl(Number left, Number right)(Code)



createUnsupportedException
protected UnsupportedOperationException createUnsupportedException(String operation, Number left)(Code)



divide
public static Number divide(Number left, Number right)(Code)



divideImpl
abstract protected Number divideImpl(Number left, Number right)(Code)



intdiv
public static Number intdiv(Number left, Number right)(Code)



intdivImpl
protected Number intdivImpl(Number left, Number right)(Code)



isBigDecimal
public static boolean isBigDecimal(Number number)(Code)



isBigInteger
public static boolean isBigInteger(Number number)(Code)



isFloatingPoint
public static boolean isFloatingPoint(Number number)(Code)



isInteger
public static boolean isInteger(Number number)(Code)



isLong
public static boolean isLong(Number number)(Code)



leftShift
public static Number leftShift(Number left, Number right)(Code)
For this operation, consider the operands independently. Throw an exception if the right operand (shift distance) is not an integral type. For the left operand (shift value) also require an integral type, but do NOT promote from Integer to Long. This is consistent with Java, and makes sense for the shift operators.



leftShiftImpl
protected Number leftShiftImpl(Number left, Number right)(Code)



mod
public static Number mod(Number left, Number right)(Code)



modImpl
protected Number modImpl(Number left, Number right)(Code)



multiply
public static Number multiply(Number left, Number right)(Code)



multiplyImpl
abstract protected Number multiplyImpl(Number left, Number right)(Code)



negate
public static Number negate(Number left)(Code)



negateImpl
abstract protected Number negateImpl(Number left)(Code)



or
public static Number or(Number left, Number right)(Code)



orImpl
protected Number orImpl(Number left, Number right)(Code)



rightShift
public static Number rightShift(Number left, Number right)(Code)
For this operation, consider the operands independently. Throw an exception if the right operand (shift distance) is not an integral type. For the left operand (shift value) also require an integral type, but do NOT promote from Integer to Long. This is consistent with Java, and makes sense for the shift operators.



rightShiftImpl
protected Number rightShiftImpl(Number left, Number right)(Code)



rightShiftUnsigned
public static Number rightShiftUnsigned(Number left, Number right)(Code)
For this operation, consider the operands independently. Throw an exception if the right operand (shift distance) is not an integral type. For the left operand (shift value) also require an integral type, but do NOT promote from Integer to Long. This is consistent with Java, and makes sense for the shift operators.



rightShiftUnsignedImpl
protected Number rightShiftUnsignedImpl(Number left, Number right)(Code)



subtract
public static Number subtract(Number left, Number right)(Code)



subtractImpl
abstract protected Number subtractImpl(Number left, Number right)(Code)



toBigDecimal
public static BigDecimal toBigDecimal(Number n)(Code)



toBigInteger
public static BigInteger toBigInteger(Number n)(Code)



xor
public static Number xor(Number left, Number right)(Code)



xorImpl
protected Number xorImpl(Number left, Number right)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.