Class Switch

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

    public class Switch
    extends Transformer

    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.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Yellow (cxh)
    Pt.ProposedRating:
    Yellow (eal)