becker.xtras.radio
Class Radio

java.lang.Object
  extended by becker.xtras.radio.Radio
Direct Known Subclasses:
SampleTuner

public class Radio
extends Object

A very simple radio that allows the frequency to be adjusted and provides a measure of the signal strength of the station being received, if there is one.

Please see the package description for a more in-depth discussion of using this class.

Author:
Byron Weber Becker

Constructor Summary
Radio()
          Construct a new Radio object.
 
Method Summary
 double getFrequency()
          Get this radio's current frequency.
 double getSignalStrength()
          Get the strength of the signal currently being received.
 void setFrequency(double frequency)
          Set this radio's current frequency.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Radio

public Radio()
Construct a new Radio object.

Method Detail

setFrequency

public void setFrequency(double frequency)
Set this radio's current frequency.

Parameters:
frequency - The new frequency for this radio.

getFrequency

public double getFrequency()
Get this radio's current frequency.

Returns:
The current frequency.

getSignalStrength

public double getSignalStrength()
Get the strength of the signal currently being received. This depends, of course, on the current frequency and whether or not there is a radio station nearby at that frequency.

Returns:
The strength of the signal being received; 0 <= strength <= 1.0