|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.electronics.SignalPipe
public class SignalPipe
A connector for moving a signal from one device to another.
A pipe has two ends, one for input and one for output.
The input of a pipe may be either unconnected or connected to a
signal source
.
The output may likewise be either unconnected or connected to a
signal processor
.
Executing a pipe is the same as executing its output processor, provided it has one. Executing a pipe with a disconnected output does nothing. Executing a pipe with a disconnected input does whatever the processor connected to its output does when it has no signal.
The connections of a pipe are normally forged in such a way that they may be unconnected and then reconnected to the same devices, or to different devices. Via the static factory methods, however, a pipe may be constructed with one of its ends welded to a device. A welded connection is permanent and may not be disconnected or connected to another device. Devices tend to create their pipes so that they are welded to themselves. Clients of these devices then connect their outputs to the inputs of other devices.
Version Info:
$Revision: 1269 $ |
$Date: 2008-05-05 14:39:39 -0600 (Mon, 05 May 2008) $ |
$Author: dharland $ (last person to modify) |
Constructor Summary | |
---|---|
SignalPipe()
Creates a new unnamed pipe that is not connected on either of its ends. |
|
SignalPipe(String pipeName)
Creates a new named pipe that is not connected on either of its ends. |
Method Summary | |
---|---|
boolean |
canConnectInputTo(SignalSource source)
Returns true if the input of this pipe may be connected to source . |
boolean |
canConnectOutputTo(SignalProcessor processor)
Returns true if the output of this pipe may be connected to processor . |
boolean |
connectInputTo(SignalSource source)
Attempts to connect the input of this pipe to source and returns
true if successful. |
boolean |
connectOutputTo(SignalProcessor processor)
Attempts to connect the output of this pipe to processor
and returns true if successful. |
boolean |
disconnectInput()
Attempts to disconnect the input of this pipe and returns true if successful. |
boolean |
disconnectOutput()
Attempts to disconnect the output of this pipe and returns true if successful. |
void |
execute()
Executes the processor connected to the output of this 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 . |
String |
getName()
Returns the name of this pipe. |
Signal |
getSignal()
Returns the signal of the source connected to the input of this pipe. |
static SignalPipe |
makeAndWeldInputTo(SignalSource source)
Creates a new pipe, welds its input to source , and returns it. |
static SignalPipe |
makeAndWeldOutputTo(SignalProcessor processor)
Creates a new pipe, welds its output to processor , and returns it. |
void |
setName(String newName)
Sets a new name for this pipe. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SignalPipe()
public SignalPipe(String pipeName)
pipeName
- an optional name for this pipe. If this value is null a
default name will be used in its place.Method Detail |
---|
public static SignalPipe makeAndWeldInputTo(SignalSource source)
source
, and returns it.
If source
is a pipe whose output is welded to another processor,
the returned pipe will be null.
source
- a source to be welded to the input of the returned pipe.
source
,
or null if the weld could not be made.public static SignalPipe makeAndWeldOutputTo(SignalProcessor processor)
processor
, and returns it.
If processor
is a pipe whose input is welded to another source,
the returned pipe will be null.
processor
- a processor to be welded to the output of the returned pipe.
processor
,
or null if the weld could not be made.public void setName(String newName)
If newName
is null or the empty string
(""), the request to change the name will be
denied and the current name will remain in place.
newName
- the new name of this pipe.public String getName()
public boolean canConnectInputTo(SignalSource source)
source
.
This method will return true if, and only if,
source
is not a pipe whose output is welded to another
processor.
source
- the device to be tested for connectability to input of this pipe.
source
.public boolean connectInputTo(SignalSource source)
source
and returns
true if successful. If the attempt was unsuccessful, this pipe
will be in the same state it was in just prior to the call to this method.
source
- the source to which the input of this pipe should be connected.
public boolean disconnectInput()
public boolean canConnectOutputTo(SignalProcessor processor)
processor
.
This method will return true if, and only if,
processor
is not a pipe whose input is welded to another
source.
processor
- the device to be tested for connectability to the output of this pipe.
source
.public boolean connectOutputTo(SignalProcessor processor)
processor
and returns true if successful.
If the attempt was unsuccessful, this pipe will be in the same
state it was in just prior to the call to this method.
processor
- the processor to which the output of this pipe should be connected.
public boolean disconnectOutput()
public Signal getSignal()
getSignal
in interface SignalSource
public void execute()
execute
in interface SignalProcessor
public void executeUpTo(SignalProcessor firstUnexecutedDevice)
SignalProcessor
firstUnexecutedDevice
.
See SignalProcessor.execute()
for more information about the linking
of processors.
executeUpTo
in interface SignalProcessor
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()
.public void executeFromStartOfChainUpTo(SignalProcessor firstUnexecutedDevice)
SignalProcessor
firstUnexecutedDevice
.
executeFromStartOfChainUpTo
in interface SignalProcessor
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |