com.webkitchen.eeg.analysis
Class BandFilter

java.lang.Object
  extended by com.webkitchen.eeg.analysis.BandFilter
All Implemented Interfaces:
IBandSampleGenerator, IChannelSampleListener, java.util.EventListener

public class BandFilter
extends java.lang.Object
implements IChannelSampleListener, IBandSampleGenerator

Listens for new raw sample values, then filters the raw data into the specified frequency band described by our FilterSpecification, and notifies listeners of the filtered value. Objects can add themselves as listeners/observers to receive copies of all new filtered samples.

See Also:
IBandSampleListener

Constructor Summary
BandFilter(FilterSpecification spec)
          Creates a new BandFilter that builds an IIRFilter to match the FilterSpecification parameter, and generates band sample values for the specified filter type
BandFilter(FilterSpecification spec, double[] filterCoefficients)
          Creates a new BandFilter that uses the filterCoefficients parameter to generate band sample values.
 
Method Summary
 void addBandListener(IBandSampleListener listener)
          Attach listener to receive notification/copies of all new band values
 void receiveSample(double rawSample)
          Processes the sample to filter for our band, and notifies our listeners of the latest band sample value
 void removeAllBandListeners()
          Remove all listeners from our notification list
 void removeBandListener(IBandSampleListener listener)
          Remove listener from our notification list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BandFilter

public BandFilter(FilterSpecification spec)
Creates a new BandFilter that builds an IIRFilter to match the FilterSpecification parameter, and generates band sample values for the specified filter type

Parameters:
spec - the specification we will use to design our IIRFilter

BandFilter

public BandFilter(FilterSpecification spec,
                  double[] filterCoefficients)
Creates a new BandFilter that uses the filterCoefficients parameter to generate band sample values. For valid results, the coefficients should have been designed by the FilterSpecification, but we don't check validity here, that is the responsibility of the caller.

Parameters:
spec - the specification we will use for our IIRFilter
filterCoefficients - the coefficients we will use to process raw samples
Method Detail

receiveSample

public void receiveSample(double rawSample)
Processes the sample to filter for our band, and notifies our listeners of the latest band sample value

Specified by:
receiveSample in interface IChannelSampleListener
Parameters:
rawSample - the raw sample that we will process

addBandListener

public void addBandListener(IBandSampleListener listener)
Attach listener to receive notification/copies of all new band values

Specified by:
addBandListener in interface IBandSampleGenerator
Parameters:
listener - the observer who wants to receive band values

removeBandListener

public void removeBandListener(IBandSampleListener listener)
Remove listener from our notification list

Specified by:
removeBandListener in interface IBandSampleGenerator
Parameters:
listener - the observer to remove

removeAllBandListeners

public void removeAllBandListeners()
Remove all listeners from our notification list

Specified by:
removeAllBandListeners in interface IBandSampleGenerator