|
|||||||||
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
A abstract number class based upon java.lang.Number
. This class extends
Number
with a couple of arithmetic methods.
Field Summary | |
static MathNumber |
MINUS_ONE
The numer -1 as MathNumber. |
static MathNumber |
ONE
The numer 1 as MathNumber. |
static MathNumber |
ZERO
The numer 0 as MathNumber. |
Constructor Summary | |
MathNumber()
|
Method Summary | |
abstract MathNumber |
abs()
Computes |this|. |
abstract MathNumber |
add(MathNumber n)
Computes this+ n . |
byte |
byteValue()
Returns the value of the number as a byte. |
int |
compareTo(MathNumber n)
Returns -1, 0 or 1 as this number is less than, equal to, or greater than n . |
abstract MathNumber |
divide(MathNumber n)
Computes this/ n . |
abstract double |
doubleValue()
Returns the value of the number as a double. |
float |
floatValue()
Returns the value of the number as a float. |
int |
intValue()
Returns the value of the number as a int. |
abstract MathNumber |
invert()
Computes 1/this. |
MathNumber |
log()
Returns the natural logarithm (base e) of this MathNumber. |
long |
longValue()
Returns the value of the number as a long. |
static MathNumber |
max(MathNumber n1,
MathNumber n2)
Returns the Maximum of the both MathNumbers (uses compareTo(gishur.core.math.MathNumber) ). |
static MathNumber |
min(MathNumber n1,
MathNumber n2)
Returns the Minimum of the both MathNumbers (uses compareTo(gishur.core.math.MathNumber) ). |
abstract MathNumber |
multiply(MathNumber n)
Computes this* n . |
abstract MathNumber |
negate()
Computes -this. |
MathNumber |
pow(long n)
Computes this^ n . |
short |
shortValue()
Returns the value of the number as a short. |
abstract int |
sign()
Determines the sign of this number. |
MathNumber |
sqrt()
Computes the square root of this. |
abstract MathNumber |
subtract(MathNumber n)
Computes this- n . |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static MathNumber ZERO
public static MathNumber ONE
public static MathNumber MINUS_ONE
Constructor Detail |
public MathNumber()
Method Detail |
public int compareTo(MathNumber n)
n
.n
- the number to compare to.n
, 0 if this==n, 1 if
this>n
.java.lang.IllegalArgumentException
- if the argument is
null
.public static MathNumber min(MathNumber n1, MathNumber n2)
compareTo(gishur.core.math.MathNumber)
).MathNumberException
- if the types of n1 and n2 are not
comparable.public static MathNumber max(MathNumber n1, MathNumber n2)
compareTo(gishur.core.math.MathNumber)
).MathNumberException
- if the types of n1 and n2 are not
comparable.public abstract int sign()
RationalNumber
public abstract MathNumber abs()
public abstract MathNumber negate()
public abstract MathNumber invert()
ArithmeticException
- if the value of this number is zero.public abstract MathNumber add(MathNumber n)
n
.n
- the number to add to this.n
.MathNumberException
- if the operation does not support the
type of n
.public abstract MathNumber subtract(MathNumber n)
n
.n
- the number to subtract from this.n
.MathNumberException
- if the operation does not support the
type of n
.public abstract MathNumber multiply(MathNumber n)
n
.n
- the number to multiply this by.n
.MathNumberException
- if the operation does not support the
type of n
.public abstract MathNumber divide(MathNumber n)
n
.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
.n
- the exponent.n
.MathNumberException
- if this Method is not supported
or if the argument is null
.public MathNumber log()
java.lang.IllegalArgumentException
- if the argument is
less than 0.MathNumberException
- if this Method is not supportedpublic MathNumber sqrt()
java.lang.IllegalArgumentException
- if the argument is
less than 0.MathNumberException
- if this Method is not supportedpublic byte byteValue()
byteValue
in class java.lang.Number
public abstract double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public short shortValue()
shortValue
in class java.lang.Number
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |