|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.features.Complex
public class Complex
Data type for complex numbers. The data type is "immutable" so once you create and initialize a complex object, you cannot change its value. The "final" keyword when declaring re and im enforces this rule, making it a compile-time error to change the .re or .im fields after they've been initialized.
| Constructor Summary | |
|---|---|
Complex(double real,
double imag)
Create a new object with the given real and imaginary parts. |
|
| Method Summary | |
|---|---|
double |
abs()
return |this| |
Complex |
conjugate()
return a new object whose value is the conjugate of this. |
double |
getIm()
Return the imaginary part. |
double |
getRe()
Return the real part. |
static void |
main(java.lang.String[] args)
|
Complex |
minus(Complex b)
return a new object whose value is (this - b). |
Complex |
plus(Complex b)
return a new object whose value is (this + b). |
Complex |
times(Complex b)
return a new object whose value is (this * b). |
Complex |
times(double alpha)
return a new object whose value is (this * alpha). |
java.lang.String |
toString()
return a string representation of the invoking object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Complex(double real,
double imag)
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic double abs()
public Complex plus(Complex b)
public Complex minus(Complex b)
public Complex times(Complex b)
public Complex times(double alpha)
public Complex conjugate()
public double getRe()
public double getIm()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||