|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--gishur.core.math.MathNumber | +--gishur.core.math.DoubleNumber
A wrapper for double values based upon MathNumber
.
DoubleNumber simply wraps a double value - like
Double
, but it too supports all arithmetic
operations defined at MathNumber
. Because
Double
is a final class, DoubleNumber cannot
extend Double, only Number
.
Fields inherited from class gishur.core.math.MathNumber |
MINUS_ONE, ONE, ZERO |
Constructor Summary | |
DoubleNumber(double d)
Default Constructor. |
|
DoubleNumber(DoubleNumber d)
Copy Constructor. |
Method Summary | |
MathNumber |
abs()
Computes |this|. |
MathNumber |
add(MathNumber n)
Computes this+ n . |
int |
compareTo(MathNumber n)
Returns -1, 0 or 1 as this number is less than, equal to, or greater than n . |
MathNumber |
divide(MathNumber n)
Computes this/ n . |
double |
doubleValue()
Returns the value of the number as a double. |
MathNumber |
invert()
Computes 1/this. |
MathNumber |
log()
Returns the natural logarithm (base e) of this MathNumber. |
MathNumber |
multiply(MathNumber n)
Computes this* n . |
MathNumber |
negate()
Computes -this. |
MathNumber |
pow(long n)
Computes this^ n . |
int |
sign()
Determines the sign of this number. |
MathNumber |
sqrt()
Computes the square root of this. |
MathNumber |
subtract(MathNumber n)
Computes this- n . |
Methods inherited from class gishur.core.math.MathNumber |
byteValue, floatValue, intValue, longValue, max, min, shortValue, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DoubleNumber(double d)
public DoubleNumber(DoubleNumber d)
Method Detail |
public int sign()
sign
in class MathNumber
RationalNumber
public int compareTo(MathNumber n)
n
.compareTo
in class MathNumber
n
- the number to compare to.n
, 0 if this==n, 1 if
this>n
.java.lang.IllegalArgumentException
- if the argument is
null
.public MathNumber abs()
abs
in class MathNumber
public MathNumber negate()
negate
in class MathNumber
public MathNumber invert()
invert
in class MathNumber
ArithmeticException
- if the value of this number is zero.public MathNumber add(MathNumber n)
n
.add
in class MathNumber
n
- the number to add to this.n
.MathNumberException
- if the operation does not support the
type of n
.public MathNumber subtract(MathNumber n)
n
.subtract
in class MathNumber
n
- the number to subtract from this.n
.MathNumberException
- if the operation does not support the
type of n
.public MathNumber multiply(MathNumber n)
n
.multiply
in class MathNumber
n
- the number to multiply this by.n
.MathNumberException
- if the operation does not support the
type of n
.public MathNumber divide(MathNumber n)
n
.divide
in class MathNumber
n
- the number to divide this by.n
.MathNumberException
- if the operation does not support the
type of n
.ArithmeticException
- if the argument is zero.public MathNumber pow(long n)
n
.pow
in class MathNumber
n
- the exponent.n
.MathNumberException
- if this Method is not supported
or if the argument is null
.public MathNumber log()
log
in class MathNumber
java.lang.IllegalArgumentException
- if the argument is
less than 0.MathNumberException
- if this Method is not supportedpublic MathNumber sqrt()
sqrt
in class MathNumber
java.lang.IllegalArgumentException
- if the argument is
less than 0.MathNumberException
- if this Method is not supportedpublic double doubleValue()
doubleValue
in class MathNumber
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |