|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmae.tut.num.Number
mae.tut.num.Ordinal
mae.tut.num.Decimal
Represents a decimal number, implemented as a float.
| Constructor Summary | |
Decimal(float x)
Use factory method Factory.newDecimal(float),
rather than this constructor |
|
| Method Summary | |
Number |
add(Number n)
Adds this Number to another Number n and returns the result. |
Number |
inverse()
Returns the multiplicative inverse of this Number. |
Number |
mult(Number n)
Multiplies this Number by another Number n and returns the result. |
java.lang.String |
toString()
String representation of this Number |
float |
value()
Returns the float value of this Number. |
| Methods inherited from class mae.tut.num.Ordinal |
compareTo, equals |
| Methods inherited from class mae.tut.num.Number |
hashCode |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Decimal(float x)
Factory.newDecimal(float),
rather than this constructor
| Method Detail |
public Number add(Number n)
Number
If this Number and n are of the same type, returned result
must be of that type.
If this and n are of different types, returned result
must be as narrow as possible.
But in all cases add(n)
and n.add(this) must return the same Number.
add in class Numberpublic Number mult(Number n)
Number
If this Number and n are of the same type, returned result
must be of that type.
If this and n are of different types, returned result
must be as narrow as possible.
But in all cases mult(n)
and n.mult(this) must return the same Number.
mult in class Numberpublic Number inverse()
Number
For any Number n, if inverse() is defined,
n.inverse().inverse() must be equal to n.
Also n.inverse().mult(n).value() must be 1.0
inverse in class Numberpublic float value()
Number
value in class Numberpublic java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||