edu.nrao.sss.electronics
Class SignalMultiplier

java.lang.Object
  extended by edu.nrao.sss.electronics.SignalMultiplier
All Implemented Interfaces:
SignalProcessor, SignalSource

public class SignalMultiplier
extends Object
implements SignalProcessor, SignalSource

A device that multiplies the current frequencies of a signal.

Version Info:

$Revision: 1241 $
$Date: 2008-04-25 14:37:37 -0600 (Fri, 25 Apr 2008) $
$Author: dharland $ (last person to modify)

Since:
2007-10-24
Author:
David M. Harland

Constructor Summary
SignalMultiplier(String deviceName, BigDecimal multiplicationFactor)
          Creates a new multiplier that uses the given multiplicationFactor.
SignalMultiplier(String deviceName, String multiplicationFactor)
          Creates a new multiplier that uses the given multiplicationFactor.
 
Method Summary
 void eraseSignalMemory()
          Erases this device's memory of its most recent execution.
 void execute()
          Runs this device on the signal received from its input pipe and then executes the processor connected to its output pipe, if any.
 void executeFromStartOfChainUpTo(SignalProcessor firstUnexecutedDevice)
          Retreats upstream from this processor to the source of the stream and executes that device(s), telling it to stop execution at firstUnexecutedDevice.
 void executeUpTo(SignalProcessor firstUnexecutedDevice)
          Executes this device and all downstream devices up to, but not including, the firstUnexecutedDevice.
 SignalPipe getInputPipe()
          Returns the input pipe of this device.
 Signal getMostRecentInput()
          Returns a copy of the input signal most recently processed by this device.
 Signal getMostRecentOutput()
          Returns a copy of the output signal most recently produced by this device.
 BigDecimal getMultiplicationFactor()
          Returns the amount by which this device multiplies its input signals.
 SignalPipe getOutputPipe()
          Returns the output pipe of this device.
 Signal getSignal()
          Returns a copy of the signal produced by the most recent execution of this device.
 Frequency multiply(Frequency input)
          Multiplies input by this multiplier's factor and returns the multiplied frequency.
 Signal multiply(Signal input)
          Multiplies input by this multiplier's factor and returns the multiplied signal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignalMultiplier

public SignalMultiplier(String deviceName,
                        BigDecimal multiplicationFactor)
Creates a new multiplier that uses the given multiplicationFactor.

Parameters:
deviceName - an optional name for this multiplier. If this value is null a default name will be used in its place.
multiplicationFactor - the amount by which this device will multiply its input signals.

SignalMultiplier

public SignalMultiplier(String deviceName,
                        String multiplicationFactor)
Creates a new multiplier that uses the given multiplicationFactor.

Parameters:
deviceName - an optional name for this multiplier. If this value is null a default name will be used in its place.
multiplicationFactor - the amount by which this device will multiply its input signals.
Method Detail

getMultiplicationFactor

public BigDecimal getMultiplicationFactor()
Returns the amount by which this device multiplies its input signals.

Returns:
the amount by which this device multiplies its input signals.

getInputPipe

public SignalPipe getInputPipe()
Returns the input pipe of this device. A typical usage pattern for this method is:
 myMultiplier.getInputPipe().connectInputTo(mySource);

Returns:
the input pipe of this device.

getOutputPipe

public SignalPipe getOutputPipe()
Returns the output pipe of this device. A typical usage pattern for this method is:
 myMultiplier.getOutputPipe().connectOutputTo(myProcessor);

Returns:
the output pipe of this device.

getMostRecentInput

public Signal getMostRecentInput()
Returns a copy of the input signal most recently processed by this device. If this processor has never been executed, or if the input signal it processed most recently was null, the returned value will be null.

Returns:
the input signal most recently sent into this multiplier.

getMostRecentOutput

public Signal getMostRecentOutput()
Returns a copy of the output signal most recently produced by this device. If this processor has never been executed, or if the input signal it processed most recently was null, the returned value will be null.

Returns:
the output signal most recently produced by this multiplier.

eraseSignalMemory

public void eraseSignalMemory()
Erases this device's memory of its most recent execution.

See Also:
getMostRecentInput(), getMostRecentOutput(), getSignal()

getSignal

public Signal getSignal()
Returns a copy of the signal produced by the most recent execution of this device. If this device has never been run, or if the input signal it processed most recently was null, the returned value will be null.

Specified by:
getSignal in interface SignalSource
Returns:
the signal provided by this device.

execute

public void execute()
Runs this device on the signal received from its input pipe and then executes the processor connected to its output pipe, if any. Both the input signal and the output produced by multiplying it are remembered by this multiplier and are available via the getMostRecentInput() and getMostRecentOutput() methods.

Specified by:
execute in interface SignalProcessor

executeUpTo

public void executeUpTo(SignalProcessor firstUnexecutedDevice)
Description copied from interface: SignalProcessor
Executes this device and all downstream devices up to, but not including, the firstUnexecutedDevice. See SignalProcessor.execute() for more information about the linking of processors.

Specified by:
executeUpTo in interface SignalProcessor
Parameters:
firstUnexecutedDevice - the first device downstream that is not to be executed. If all downstream devices should be executed you may use a null value here or call SignalProcessor.execute().

executeFromStartOfChainUpTo

public void executeFromStartOfChainUpTo(SignalProcessor firstUnexecutedDevice)
Description copied from interface: SignalProcessor
Retreats upstream from this processor to the source of the stream and executes that device(s), telling it to stop execution at firstUnexecutedDevice.

Specified by:
executeFromStartOfChainUpTo in interface SignalProcessor
Parameters:
firstUnexecutedDevice - the first device in a chain of processors that is not to be executed. If all devices should be executed you may use a null value here. The first unexecuted device should be downstream of this device.

multiply

public Signal multiply(Signal input)
Multiplies input by this multiplier's factor and returns the multiplied signal.

Note that the input signal and this multiplier are not affected by calls to this method. In other words this multiplier will not remember the input signal sent in or the output signal produced. This is in contrast to a call to the execute() methods.

Parameters:
input - the signal to be multiplied.
Returns:
a new signal that is the result of multiplying input by this multiplier's factor.

multiply

public Frequency multiply(Frequency input)
Multiplies input by this multiplier's factor and returns the multiplied frequency.

Note that the input frequency and this multiplier are not affected by calls to this method. In other words this multiplier will not remember the input signal sent in or the output signal produced. This is in contrast to a call to the execute() methods.

Parameters:
input - the frequency to be multiplied.
Returns:
a new frequency that is the result of multiplying input by this multiplier's factor.


Copyright © 2009. All Rights Reserved.