|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
vec_math.Complex
public class Complex
A number representing a complex number. All methods that access the number as a primitive data type return the length of the complex number. A complex number always consists of two Doubles, the real part and the imaginary part.
| Field Summary | |
|---|---|
private double |
imaginary
The imaginary part of the complex. |
private double |
real
The real part of the complex. |
| Constructor Summary | |
|---|---|
Complex(double r,
double i)
Constructs a new Complex from two primitive doubles, the first is the real part, the second the imaginary part. |
|
Complex(String comp)
Constructs a new Complex from a String. |
|
| Method Summary | |
|---|---|
Complex |
add(Complex b)
return a new object whose value is (this + b) |
Complex |
conjugate()
|
double |
doubleValue()
Converts the complex to a double. |
boolean |
equals(Object other)
Checks for equality. |
float |
floatValue()
Converts the complex to a float. |
double |
getImaginary()
Returns the imaginary part. |
double |
getReal()
Returns the real part of the complex. |
int |
intValue()
Converts the complex to an integer. |
double |
length()
Returns the length of this complex. |
double |
lengthSq()
Returns the square length of this complex. |
long |
longValue()
Converts the complex to a long. |
static void |
main(String[] arg)
Testing. |
Complex |
multiply(Complex b)
return a new object whose value is (this * b) |
Complex |
multiply(double alpha)
return a new complex stretched by the factor. |
Complex |
subtract(Complex b)
return a new object whose value is (this - b) |
double |
theta()
Returns the theta of this complex. |
String |
toString()
Retunrs the complex as a string. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private double real
private double imaginary
| Constructor Detail |
|---|
public Complex(String comp)
public Complex(double r,
double i)
| Method Detail |
|---|
public int intValue()
intValue in class Numberpublic long longValue()
longValue in class Numberpublic float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic double theta()
public double length()
public double lengthSq()
public double getReal()
public double getImaginary()
public Complex add(Complex b)
public Complex subtract(Complex b)
public Complex multiply(Complex b)
public Complex multiply(double alpha)
public Complex conjugate()
public boolean equals(Object other)
equals in class Objectpublic String toString()
toString in class Objectpublic static void main(String[] arg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||