Class Inhibit

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

    public class Inhibit
    extends Transformer
    Output a received input token, unless the inhibit port receives a token at the same time. If no token has been received on the input port when a token is received on the inhibit port, then no output is produced. The inputs can be of any token type, and the output is constrained to be of a type at least that of the input.

    Both the input port and the output port are multiports. Generally, their widths should match. Otherwise, if the width of the input is greater than the width of the output, the extra input tokens will not appear on any output, although they will be consumed from the input port. If the width of the output is greater than that of the input, then the last few channels of the output will never emit tokens.

    This actor is similar to the Sampler actor in that it modifies a stream of events based on the presence or absence of events from another input. This actor reacts to the absence of the other event, whereas Sampler reacts to the presence of it.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Steve Neuendorffer and Edward A. Lee
    See Also:
    MostRecent
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Yellow (neuendor)
    • Field Detail

      • inhibit

        public TypedIOPort inhibit
        The inhibit port, which has type Token. If this port does not receive a token, then the most recent token from the input port will be emitted on the output port.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        Consume at most one token from each channel of the input port. If there is a token on the inhibit port, then consume it and discard the input tokens. If no token is present on the inhibit port, then emit the input tokens on the output port. If there are no input tokens then no output is produced.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If there is no director.