
Select |
ptolemy.actor.lib.Select |
A polymorphic select, which routes specified input channels to the
output. This actor has two input ports, the input port for
data, and the control port to select which input channel to
read. In an iteration, if an input token is available at the
control input, that token is read, and its value is noted. Its
value specifies the input channel that should be read next. If an
input token is available on the specified channel of the input
port, then that token is read and sent to the output.
The actor indicates a willingness to fire in its prefire() method
if there is an input available on the channel specified by the most
recently seen token on the control port. If no token has ever
been received on the control port, then channel zero is assumed
to be the one to read. 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 input), then the actor will
not fire() (although it will continue to consume tokens on the
control port in its prefire() method).
This actor is similar to the Multiplexor actor, except that it
never discards input tokens. Tokens on channels that are not selected
are not consumed.
Note that in the DE domain, where this actor is commonly used, if
a new value is given to the control port, then all previously
unread input tokens on the specified input channel will be read at the
same firing time, in the order in which they arrived.
Author(s): Edward A. Lee
Version:$Id: Select.java,v 1.26 2005/10/28 20:14:59 cxh Exp $
Pt.Proposed Rating:Green (neuendor)
Pt.Accepted Rating:Yellow (liuj)
control
Input port for control tokens, which specify the output channel
to produce data on. The type is int.