public abstract class Number<T extends Number<T>> extends java.lang.Number implements Ring<T>, java.lang.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(java.lang.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 . |
java.lang.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, plus
public Number()
public abstract boolean isLargerThan(T that)
|this| > |that|
public abstract long longValue()
long
.longValue
in class java.lang.Number
long
.public abstract double doubleValue()
double
.doubleValue
in class java.lang.Number
double
.public abstract int compareTo(T that)
(x.compareTo(y)==0) == (x.equals(y))
,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.thisexp
java.lang.IllegalArgumentException
- if exp <= 0
public final byte byteValue()
byte
.
This may involve rounding or truncation.byteValue
in class java.lang.Number
byte
.public final short shortValue()
short
.
This may involve rounding or truncation.shortValue
in class java.lang.Number
short
.public final int intValue()
int
.
This may involve rounding or truncation.intValue
in class java.lang.Number
int
.public final float floatValue()
float
.
This may involve rounding.floatValue
in class java.lang.Number
float
.public abstract boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to be compared with.true
if this number and the specified argument
represent the same number; false
otherwise.public abstract int hashCode()
equals(Object)
.hashCode
in class java.lang.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.Realtime
public abstract Number<T> copy()
allocated
by the calling thread (possibly on the stack).copy
in interface javolution.lang.ValueType
public final java.lang.String toString()
java.lang.String
.toString
in class java.lang.Object
toText().toString()