|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmae.tut.num.Factory
Defines static methods to construct Numbers.
Factory methods for constructing Whole, Rational, Decimal, Complex.
These methods are preferred to the constructors, because they select the proper constructor depending on the arguments.
| Method Summary | |
static Cruncher |
cruncher()
Returns Cruncher instance for calculation on Numbers |
static Number |
newComplex(float re,
float im)
Factory method that constructs a Complex,
a Decimal or a Whole. |
static Number |
newDecimal(float x)
Factory method that constructs a Decimal
or a Whole. |
static Number |
newMatrix(float a,
float b,
float c,
float d)
Factory method that constructs a Matrix. |
static Number |
newRational(long num,
long den)
Factory method that constructs a Rational
or a Whole. |
static Number |
newWhole(long n)
Factory method that constructs a Whole. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Cruncher cruncher()
public static Number newWhole(long n)
Whole.
This is equivalant to new Whole(n).
public static Number newRational(long num,
long den)
Rational
or a Whole.
If den==gcd(num,den),
a Whole is returned.
public static Number newDecimal(float x)
Decimal
or a Whole.
If String value of x ends with ".0", x represents an integer, a Whole is returned.
public static Number newComplex(float re,
float im)
Complex,
a Decimal or a Whole.
If im==0, newDecimal() is invoked.
public static Number newMatrix(float a,
float b,
float c,
float d)
Matrix.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||