com.xinapse.multisliceimage
Class DoubleComplex

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

public final class DoubleComplex
extends java.lang.Object

A complex (real, imaginary) number, with double precision.


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

Constructor Detail

DoubleComplex

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


DoubleComplex

public DoubleComplex(double r,
                     double i)
Creates a new DoubleComplex number, with the real and imaginary parts specified by the arguments.

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

DoubleComplex

public DoubleComplex(DoubleComplex c)
Creates a new DoubleComplex number, with the real and imaginary parts copied from an existing DoubleComplex.

Parameters:
c - the DoubleComplex to copy.
Method Detail

set

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

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

setReal

public void setReal(double r)
Sets the real part of this DoubleComplex number.

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

setImag

public void setImag(double i)
Sets the imaginary part of this DoubleComplex number.

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

polar

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

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

getReal

public double getReal()
Returns the real part of this DoubleComplex number.

Returns:
the real part of this DoubleComplex number.

getImag

public double getImag()
Returns the imaginary part of this DoubleComplex number.

Returns:
the imaginary part of this DoubleComplex number.

getArg

public double getArg()
Returns the polar angle of this DoubleComplex number.

Returns:
the polar angle of this DoubleComplex number.

getMod

public double getMod()
Returns the modulus of this DoubleComplex number.

Returns:
the modulus of this DoubleComplex number.

equals

public boolean equals(java.lang.Object o)
Determines whether another object is equal to this DoubleComplex number.
The result is true if and only if the argument is not null and is a DoubleComplex object that has the same real and imaginary components as this DoubleComplex 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 DoubleComplex number.

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


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