Java Doc for Rational.java in  » Science » jscience-4.3.1 » org » jscience » mathematics » number » 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 » Science » jscience 4.3.1 » org.jscience.mathematics.number 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.jscience.mathematics.number.Rational

Rational
final public class Rational extends Number implements Field<Rational>(Code)

This class represents the ratio of two LargeInteger numbers.

Instances of this class are immutable and can be used to find exact solutions to linear equations with the org.jscience.mathematics.vector.Matrix Matrix class.


author:
   Jean-Marie Dautelle
version:
   3.0, February 13, 2006
See Also:    * Wikipedia: Rational Numbers


Field Summary
final public static  RationalONE
     The Rational representing the multiplicative identity.
final static  XMLFormat<Rational>XML
     Holds the default XML representation for rational numbers.
final public static  RationalZERO
     The Rational representing the additive identity.


Method Summary
public  Rationalabs()
     Returns the absolute value of this rational number.
public  intcompareTo(Rational that)
     Compares two rational number numerically.
Parameters:
  that - the rational number to compare with.
public  Rationalcopy()
    
public  Rationaldivide(Rational that)
     Returns this rational number divided by the one specified.
Parameters:
  that - the rational number divisor.
public  doubledoubleValue()
     Returns the value of this rational number as a double.
public  booleanequals(Object that)
     Compares this rational number against the specified object.
Parameters:
  that - the object to compare with.
public  LargeIntegergetDividend()
     Returns the smallest dividend of the fraction representing this rational number.
public  LargeIntegergetDivisor()
     Returns the smallest divisor of the fraction representing this rational (always positive).
public  inthashCode()
     Returns the hash code for this rational number.
public  Rationalinverse()
     Returns the inverse of this rational number.
public  booleanisLargerThan(Rational that)
     Compares the absolute value of two rational numbers.
Parameters:
  that - the rational number to be compared with.
public  booleanisNegative()
     Indicates if this rational number is less than zero.
public  booleanisPositive()
     Indicates if this rational number is greater than zero.
public  booleanisZero()
     Indicates if this rational number is equal to zero.
public  longlongValue()
     Returns the value of this rational number as a long.
public  Rationalminus(Rational that)
     Returns the difference between this rational number and the one specified.
Parameters:
  that - the rational number to be subtracted.
public  Rationalopposite()
     Returns the opposite of this rational number.
public  Rationalplus(Rational that)
     Returns the sum of this rational number with the one specified.
Parameters:
  that - the rational number to be added.
public  LargeIntegerround()
     Returns the closest integer value to this rational number.
public  Rationaltimes(long multiplier)
     Returns the product of this rational number with the specified long multiplier.
Parameters:
  multiplier - the long multiplier.
public  Rationaltimes(Rational that)
     Returns the product of this rational number with the one specified.
Parameters:
  that - the rational number multiplier.
public  TexttoText()
     Returns the decimal text representation of this number.
public static  RationalvalueOf(long dividend, long divisor)
     Returns the rational number for the specified integer dividend and divisor.
public static  RationalvalueOf(LargeInteger dividend, LargeInteger divisor)
     Returns the rational number for the specified large integer dividend and divisor.
public static  RationalvalueOf(CharSequence chars)
     Returns the rational number for the specified character sequence.
Parameters:
  chars - the character sequence.

Field Detail
ONE
final public static Rational ONE(Code)
The Rational representing the multiplicative identity.



XML
final static XMLFormat<Rational> XML(Code)
Holds the default XML representation for rational numbers. This representation consists of a simple value attribute holding the Rational.toText() textual representation.



ZERO
final public static Rational ZERO(Code)
The Rational representing the additive identity.





Method Detail
abs
public Rational abs()(Code)
Returns the absolute value of this rational number. |this|.



compareTo
public int compareTo(Rational that)(Code)
Compares two rational number numerically.
Parameters:
  that - the rational number to compare with. -1, 0 or 1 as this rational number is numerically less than, equal to, or greater than that.



copy
public Rational copy()(Code)



divide
public Rational divide(Rational that)(Code)
Returns this rational number divided by the one specified.
Parameters:
  that - the rational number divisor. this / that.
throws:
  ArithmeticException - if that.equals(ZERO)



doubleValue
public double doubleValue()(Code)
Returns the value of this rational number as a double. the numeric value represented by this rational after conversionto type double.



equals
public boolean equals(Object that)(Code)
Compares this rational number against the specified object.
Parameters:
  that - the object to compare with. true if the objects are the same;false otherwise.



getDividend
public LargeInteger getDividend()(Code)
Returns the smallest dividend of the fraction representing this rational number. this rational dividend.



getDivisor
public LargeInteger getDivisor()(Code)
Returns the smallest divisor of the fraction representing this rational (always positive). this rational divisor.



hashCode
public int hashCode()(Code)
Returns the hash code for this rational number. the hash code value.



inverse
public Rational inverse()(Code)
Returns the inverse of this rational number. 1 / this.
throws:
  ArithmeticException - if dividend.isZero()



isLargerThan
public boolean isLargerThan(Rational that)(Code)
Compares the absolute value of two rational numbers.
Parameters:
  that - the rational number to be compared with. |this| > |that|



isNegative
public boolean isNegative()(Code)
Indicates if this rational number is less than zero. this < 0



isPositive
public boolean isPositive()(Code)
Indicates if this rational number is greater than zero. this > 0



isZero
public boolean isZero()(Code)
Indicates if this rational number is equal to zero. this == 0



longValue
public long longValue()(Code)
Returns the value of this rational number as a long. the numeric value represented by this rational after conversionto type long.



minus
public Rational minus(Rational that)(Code)
Returns the difference between this rational number and the one specified.
Parameters:
  that - the rational number to be subtracted. this - that.



opposite
public Rational opposite()(Code)
Returns the opposite of this rational number. -this.



plus
public Rational plus(Rational that)(Code)
Returns the sum of this rational number with the one specified.
Parameters:
  that - the rational number to be added. this + that.



round
public LargeInteger round()(Code)
Returns the closest integer value to this rational number. this rational rounded to the nearest integer.



times
public Rational times(long multiplier)(Code)
Returns the product of this rational number with the specified long multiplier.
Parameters:
  multiplier - the long multiplier. this · multiplier.



times
public Rational times(Rational that)(Code)
Returns the product of this rational number with the one specified.
Parameters:
  that - the rational number multiplier. this · that.



toText
public Text toText()(Code)
Returns the decimal text representation of this number. the text representation of this number.



valueOf
public static Rational valueOf(long dividend, long divisor)(Code)
Returns the rational number for the specified integer dividend and divisor.
Parameters:
  dividend - the dividend value.
Parameters:
  divisor - the divisor value. dividend / divisor
throws:
  ArithmeticException - if divisor == 0



valueOf
public static Rational valueOf(LargeInteger dividend, LargeInteger divisor)(Code)
Returns the rational number for the specified large integer dividend and divisor.
Parameters:
  dividend - the dividend value.
Parameters:
  divisor - the divisor value. dividend / divisor
throws:
  ArithmeticException - if divisor.isZero()



valueOf
public static Rational valueOf(CharSequence chars)(Code)
Returns the rational number for the specified character sequence.
Parameters:
  chars - the character sequence. the corresponding rational number.



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