public abstract class Number<T extends Number<T>> extends Number implements Ring<T>, Comparable<T>, javolution.lang.Realtime, javolution.xml.XMLSerializable
This class represents a value-type
number.
| Constructor and Description |
|---|
Number() |
| Modifier and Type | Method and Description |
|---|---|
byte |
byteValue()
Returns the value of this number as a
byte. |
abstract int |
compareTo(T that)
Compares this number with the specified number for order.
|
abstract Number<T> |
copy()
Returns a copy of this number
allocated
by the calling thread (possibly on the stack). |
abstract double |
doubleValue()
Returns the value of this number as a
double. |
abstract boolean |
equals(Object obj)
Indicates if this number is equals to the specified object.
|
float |
floatValue()
Returns the value of this number as a
float. |
abstract int |
hashCode()
Returns the hash code for this number (consistent with
equals(Object). |
int |
intValue()
Returns the value of this number as an
int. |
boolean |
isGreaterThan(T that)
Indicates if this number is ordered after that number
(convenience method).
|
abstract boolean |
isLargerThan(T that)
Compares the magnitude of this number with that number.
|
boolean |
isLessThan(T that)
Indicates if this number is ordered before that number
(convenience method).
|
abstract long |
longValue()
Returns the value of this number as a
long. |
T |
minus(T that)
Returns the difference between this number and the one specified.
|
T |
pow(int exp)
Returns this number raised at the specified positive exponent.
|
short |
shortValue()
Returns the value of this number as a
short. |
String |
toString()
Returns the text representation of this number as a
java.lang.String. |
abstract javolution.text.Text |
toText()
Returns the textual representation of this real-time object
(equivalent to
toString except that the returned value
can be allocated from the local context space). |
opposite, pluspublic abstract boolean isLargerThan(T that)
|this| > |that|public abstract long longValue()
long.public abstract double doubleValue()
double.doubleValue in class Numberdouble.public abstract int compareTo(T that)
(x.compareTo(y)==0) == (x.equals(y)),compareTo in interface Comparable<T extends Number<T>>that - the number to be compared.public final boolean isLessThan(T that)
that - the number to compare with.this.compareTo(that) < 0.public final boolean isGreaterThan(T that)
that - the number to compare with.this.compareTo(that) > 0.public T minus(T that)
that - the number to be subtracted.this - that.public T pow(int exp)
exp - the positive exponent.thisexpIllegalArgumentException - if exp <= 0public final byte byteValue()
byte.
This may involve rounding or truncation.public final short shortValue()
short.
This may involve rounding or truncation.shortValue in class Numbershort.public final int intValue()
int.
This may involve rounding or truncation.public final float floatValue()
float.
This may involve rounding.floatValue in class Numberfloat.public abstract boolean equals(Object obj)
public abstract int hashCode()
equals(Object).public abstract javolution.text.Text toText()
toString except that the returned value
can be allocated from the local context space).toText in interface javolution.lang.Realtimepublic abstract Number<T> copy()
allocated
by the calling thread (possibly on the stack).copy in interface javolution.lang.ValueType