net.sarcommand.fft
Class ComplexSignal

java.lang.Object
  extended by net.sarcommand.fft.ComplexSignal
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class ComplexSignal
extends java.lang.Object
implements java.io.Externalizable

Author:
A. O. Ergueven, Torsten Heup
Represents a complex signal of any kind. This class holds onedimensional signals as well as twodimensional signals. The complex numbers are represented by two float arrays for the real and the imaginary part.
See Also:
Serialized Form

Field Summary
protected  float[] _imag
          Holds the imaginary parts of the complex numbers in this signal.
protected  float[] _real
          Holds the real parts of the complex numbers in this signal.
 int height
          If the signal is twodimensional, this variable holds the signals height.
 int length
          This signal's total length.
 int width
          If the signal is twodimensional, this variable holds the signals width.
 
Constructor Summary
ComplexSignal()
          Creates a new complex signal.
ComplexSignal(int size)
          Creates a new onedimensional signal with the length 'size'.
ComplexSignal(int width, int height)
          Creates a new twodimensional signal.
 
Method Summary
 ComplexSignal copy()
          Creates an exact copy of this signal.
 boolean equals(java.lang.Object o)
          Returns whether this signal is completely equal to the specified one.
 float[] getImaginaryPart()
          Returns the signal's imaginary part.
 float[] getRealPart()
          Returns the signal's real part.
 boolean is2D()
          Returns whether this signal is twodimensional.
 void readExternal(java.io.ObjectInput in)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_real

protected float[] _real
Holds the real parts of the complex numbers in this signal.


_imag

protected float[] _imag
Holds the imaginary parts of the complex numbers in this signal.


length

public int length
This signal's total length.


width

public int width
If the signal is twodimensional, this variable holds the signals width.


height

public int height
If the signal is twodimensional, this variable holds the signals height.

Constructor Detail

ComplexSignal

public ComplexSignal()
Creates a new complex signal. This constructor is meant to be used only be the externalization mechanisms and should not be invoked.


ComplexSignal

public ComplexSignal(int size)
Creates a new onedimensional signal with the length 'size'.

Parameters:
size - Length of signal

ComplexSignal

public ComplexSignal(int width,
                     int height)
Creates a new twodimensional signal.

Parameters:
width - Signal's width
height - Signal's height
Method Detail

getRealPart

public float[] getRealPart()
Returns the signal's real part.

Returns:
real part

getImaginaryPart

public float[] getImaginaryPart()
Returns the signal's imaginary part.

Returns:
imaginary part

copy

public ComplexSignal copy()
Creates an exact copy of this signal.

Returns:
Signal's clone

is2D

public boolean is2D()
Returns whether this signal is twodimensional.

Returns:
true if signal is 2D, false otherwise.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(java.io.ObjectOutput)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(java.io.ObjectInput)

equals

public boolean equals(java.lang.Object o)
Returns whether this signal is completely equal to the specified one.

Overrides:
equals in class java.lang.Object
Parameters:
o - Signal to compare with
Returns:
true if signals are equal, false otherwise