Laazy
Class Complex

java.lang.Object
  extended by Laazy.Complex

public class Complex
extends java.lang.Object


Constructor Summary
Complex(Complex number)
           
Complex(double a, double b)
           
Complex(java.lang.String imaginaryNumber)
           
 
Method Summary
 void add(Complex number)
           
 void add(double x)
           
 void add(java.lang.String imaginaryNumber)
           
 void divide(Complex number)
           
 void divide(double x)
           
 void divide(java.lang.String imaginaryNumber)
           
 boolean equals(Complex number)
           
 boolean equals(java.lang.String imaginaryNumber)
           
 Complex getConjugate()
           
 double getMagnitude()
           
 void multiply(Complex number)
           
 void multiply(double x)
           
 void multiply(java.lang.String imaginaryNumber)
           
 void pow(int x)
           
 Complex sgn()
           
 Complex sqrt()
           
 void subtract(Complex number)
           
 void subtract(double x)
           
 void subtract(java.lang.String imaginaryNumber)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Complex

public Complex(double a,
               double b)
Parameters:
a - the real part of a complex number
b - the imaginary part of a complex number

Complex

public Complex(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation of a complex number in a+bi form by which to initial this complex number object

Complex

public Complex(Complex number)
Parameters:
number - a complex number object by which to initial this complex number object
Method Detail

add

public void add(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation of a complex number to add to this object

add

public void add(Complex number)
Parameters:
number - a complex number object to add to this object

add

public void add(double x)
Parameters:
x - a real number by which to add to this object

subtract

public void subtract(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation of a complex number by which to subtract from this complex number object

subtract

public void subtract(Complex number)
Parameters:
number - a complex number object by which to subtract from this complex number object

subtract

public void subtract(double x)
Parameters:
x - a real number by which to subtract from this complex number object

multiply

public void multiply(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation of a complex number by which to multiply this complex number

multiply

public void multiply(Complex number)
Parameters:
number - a complex number object by which to multiply this complex number object

multiply

public void multiply(double x)
Parameters:
x - a real number by which to multiply this complex number object

divide

public void divide(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation by which to divide this complex number

divide

public void divide(Complex number)
Parameters:
number - a complex number by which to divide this complex number

divide

public void divide(double x)
Parameters:
x - a real number by which to divide this complex number

pow

public void pow(int x)
Parameters:
x - the power to which this complex number should be raised - must be positive

sqrt

public Complex sqrt()
Returns:
the square root of this complex number object

getMagnitude

public double getMagnitude()
Returns:
the magnitude (a.k.a. modulus or absolute value) of this complex number

sgn

public Complex sgn()
Returns:
the signum of this complex number object

equals

public boolean equals(java.lang.String imaginaryNumber)
Parameters:
imaginaryNumber - a String representation of a complex number
Returns:
true if the parameter equals this complex number or false if the parameter does not equal this complex number

equals

public boolean equals(Complex number)
Parameters:
number - a complex number object
Returns:
true if the parameter equals this complex number or false if the parameter does not equal this complex number

getConjugate

public Complex getConjugate()
Returns:
the conjugate of this complex number

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this complex number object in a+bi form