
Switch |
ptolemy.actor.lib.Switch |
A polymorphic switch, which routes inputs to specified output channels.
This actor has two input ports, the input port for data,
and the control port to select which output channel to use.
When it fires, if an input token is available at the control
input, that token is read, and its value is noted. If an input
token is available on the input port, then that token is
read, sent to the output channel specified by the most recently
received value on the control port. If no token has been
received on the control port, then the token is sent to
channel zero. If the value of the most recently received token
on the control port is out of range (less than zero,
or greater than or equal to the width of the output), then no
output is produced, and the token is lost.
Note that it may be tempting to call an instance of this
class "switch", but recall that "switch" is a Java keyword, and
thus it cannot be the name of an object.
Author(s): Edward A. Lee
Version:$Id: Switch.java,v 1.24 2005/10/28 20:15:03 cxh Exp $
Pt.Proposed Rating:Yellow (eal)
Pt.Accepted Rating:Yellow (cxh)
control
Input port for control tokens, which specify the output channel
to produce data on. The type is int.