com.xinapse.multisliceimage
Class Complex

java.lang.Object
  extended by com.xinapse.multisliceimage.Complex

public final class Complex
extends java.lang.Object

A complex (real, imaginary) number.


Constructor Summary
Complex()
          Creates a new Complex number, with zero real and imaginary parts.
Complex(float r, float i)
          Creates a new Complex number, with the real and imaginary part specified by the arguments.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines whether another object is equal to this Complex number.
 float getArg()
          Returns the polar angle of this Complex number.
 float getImag()
          Returns the imaginary part of this Complex number.
 float getMod()
          Returns the modulus of this Complex number.
 float getReal()
          Returns the real part of this Complex number.
 int hashCode()
          Returns a hash code value for this Complex number.
 void polar(float mod, float arg)
          Set real and imaginary components of this Complex given the modulus and argument (in radians).
 void set(float r, float i)
          Sets the real and imaginary parts of this Complex number.
 void setImag(float i)
          Sets the imaginary part of this Complex number.
 void setReal(float r)
          Sets the real part of this Complex number.
 java.lang.String toString()
          Returns a string representation of this Complex number.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Complex

public Complex()
Creates a new Complex number, with zero real and imaginary parts.


Complex

public Complex(float r,
               float i)
Creates a new Complex number, with the real and imaginary part specified by the arguments.

Parameters:
r - the real part of the complex number.
i - the imaginary part of the complex number.
Method Detail

set

public void set(float r,
                float i)
Sets the real and imaginary parts of this Complex number.

Parameters:
r - the new real part of the complex number.
i - the new imaginary part of the complex number.

setReal

public void setReal(float r)
Sets the real part of this Complex number.

Parameters:
r - the new real part of the complex number.

setImag

public void setImag(float i)
Sets the imaginary part of this Complex number.

Parameters:
i - the new imaginary part of the complex number.

polar

public void polar(float mod,
                  float arg)
Set real and imaginary components of this Complex given the modulus and argument (in radians).

Parameters:
mod - the modulus.
arg - the argument in radians.

getReal

public float getReal()
Returns the real part of this Complex number.

Returns:
the real part of this Complex number.

getImag

public float getImag()
Returns the imaginary part of this Complex number.

Returns:
the imaginary part of this Complex number.

getArg

public float getArg()
Returns the polar angle of this Complex number.

Returns:
the polar angle of this Complex number.

getMod

public float getMod()
Returns the modulus of this Complex number.

Returns:
the modulus of this Complex number.

equals

public boolean equals(java.lang.Object o)
Determines whether another object is equal to this Complex number.
The result is true if and only if the argument is not null and is a Complex object that has the same real and imaginary components as this Complex object.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this Complex number.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this Complex number.

toString

public java.lang.String toString()
Returns a string representation of this Complex number.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this Complex.


Copyright 2006-2011 Xinapse Systems Limited. All Rights Reserved.