Class Register

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

    public class Register
    extends MostRecent
    A register is a stateful actor with a trigger port that accepts read requests.

    In the fire() method, if there is an event on the trigger input port, this actor will produce an output event. The value of the output event will be the previously recorded event from the input port, or the value of the initialValue parameter if there has been no previous input event. If, however, initialValue contains no value, then no output will be produced. In the postfire() method, if there is an input event on the input port, then its value is recorded to be used in future firings as the value of the output.

    The inputs can be of any token type, but the output port is constrained to be of a type at least that of the input port and the initialValue parameter.

    This class extends MostRecent. Unlike its base class, this actor can be used to break dependencies in a feedback loop in that the input tokens are consumed from the input ports after the outputs are generated. Another difference is that the Register actor can be fired when either the trigger port or the input port has a token, while the Sampler can only be fired when the trigger port receives a token.

    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.

    Note: If the width of the input changes during execution, then the most recent inputs are forgotten, as if the execution of the model were starting over.

    Since:
    Ptolemy II 4.1
    Version:
    $Id$
    Author:
    Edward A. Lee, Haiyang Zheng
    See Also:
    MostRecent
    Pt.AcceptedRating:
    Red (eal)
    Pt.ProposedRating:
    Yellow (eal)