public class ComplexNumber
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
m_dImaginary
The imaginary part of the complex number as double.
|
double |
m_dReal
The real part of the complex number as double.
|
Constructor and Description |
---|
ComplexNumber(ComplexNumber pComplexNumber) |
ComplexNumber(double dReal,
double dImaginary)
Creates a complex number with the specified real and imaginary part.
|
Modifier and Type | Method and Description |
---|---|
ComplexNumber |
add(ComplexNumber pOtherNumber)
Returns A complex number that is the sum between this complex number and the specified parameter.
|
void |
addToThis(ComplexNumber pOtherNumber)
Adds the values of the specified complex number to this complex number.
|
ComplexNumber |
divideBy(ComplexNumber pOtherNumber)
Returns A complex number that is the result of this complex number divided by the specified complex number.
|
void |
divideThisBy(ComplexNumber pOtherNumber)
Divides this complex number by the specified complex number.
|
boolean |
equals(ComplexNumber pOtherNumber)
Returns true, if the specified complex number is equal to this object.
|
double |
getLength()
Returns the length of the complex number (i.e. the length of the vector in the complex plane).
|
ComplexNumber |
multiply(ComplexNumber pOtherNumber)
Returns A complex number that is the result of this complex number multiplied by the specified complex number.
|
void |
multiplyWithThis(ComplexNumber pOtherNumber)
Multiplies the values of the specified complex number with this complex number.
|
ComplexNumber |
subtract(ComplexNumber pOtherNumber)
Returns A complex number that is the result of this complex number subtracted by the specified complex number.
|
void |
subtractFromThis(ComplexNumber pOtherNumber)
Subtracts the values of the specified complex number from this complex number.
|
java.lang.String |
toString() |
public double m_dReal
public double m_dImaginary
public ComplexNumber(double dReal, double dImaginary)
dReal
- The real part of the complex number as double.dImaginary
- The imaginary part of the complex number as double.public ComplexNumber(ComplexNumber pComplexNumber)
public double getLength()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be compared.public ComplexNumber add(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be added to the values of this object.public void addToThis(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be added to the values of this object.public ComplexNumber subtract(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be subtracted from the values of this object.public void subtractFromThis(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be subtracted from the values of this object.public ComplexNumber multiply(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be multiplied with the values of this object.public void multiplyWithThis(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be multiplied with the values of this object.public ComplexNumber divideBy(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be used to divide this object.public void divideThisBy(ComplexNumber pOtherNumber)
pOtherNumber
- The other complex number that should be used to divide this object.