Class Select

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class Select
    extends Transformer

    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.

    Note further that this actor is subtly different from the BooleanSelect actor. In addition to the obvious difference that the latter accepts only two input streams, the latter also requires two firings to produce an output. The BooleanSelect actor is designed to work with DDF, but because of the multiple firings, will not work with DE or SR. This actor will, because it consumes the control input and the data input in the same firing.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Yellow (liuj)
    Pt.ProposedRating:
    Green (neuendor)