Class Recorder

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

    public class Recorder
    extends Sink

    Record all input tokens for later querying. This actor can be used for testing configurations of actors. It can also be used in programs that invoke Ptolemy models and wish to query the results after the model is run. The input tokens are read in the postfire() method so that in domains with fixed-point semantics, only the final, settled value is recorded. The current time is also recorded for each value.

    The capacity parameter limits the size of the record. If the capacity is set to zero, then no tokens are recorded, but the total number of input tokens is counted. You can access the count via the getCount() method. If the capacity is 1, then only the most recently seen token on each channel is recorded. If the capacity is negative (the default), then the capacity is infinite.

    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Green (bilung)
    Pt.ProposedRating:
    Green (eal)
    • Field Detail

      • capacity

        public Parameter capacity
        The capacity of the record for each channel. This parameter must contain an IntToken.
    • Method Detail

      • getCount

        public int getCount()
        Get the total number of events seen so far.
        Returns:
        The total number of events seen so far.
      • getHistory

        public java.util.List getHistory​(int channel)
        Get the history for the specified channel number. If in any firing there is no such channel, or no token was read on that channel, then a string token with value "_" is returned in the position of the list corresponding to that firing. If nothing has been recorded (there have been no firings), then return an empty list.
        Parameters:
        channel - The input channel for which the history is desired.
        Returns:
        A list of Token objects.
      • getLatest

        public Token getLatest​(int channel)
        Get the latest input for the specified channel. If there has been no record yet for the specified channel, then return the string token "_", representing "bottom".
        Parameters:
        channel - The input channel for the record is desired.
        Returns:
        The latest input token.
      • getRecord

        @Deprecated
        public java.util.Enumeration getRecord​(int channel)
        Deprecated.
        This method is deprecated. Use getHistory().
        Get the record for the specified channel number. If in any firing there is no such channel, or no token was read on that channel, then a string token with value "_" is returned. If nothing has been recorded (there have been no firings), then return an empty enumeration.
        Parameters:
        channel - The input channel for the record is desired.
        Returns:
        An enumeration of Token objects.
      • getTimeHistory

        public java.util.List getTimeHistory()
        Get the history of the time of each invocation of postfire().
        Returns:
        A list of Double objects.
      • getTimeRecord

        @Deprecated
        public java.util.Enumeration getTimeRecord()
        Deprecated.
        This method is deprecated. Use getTimeHistory().
        Get the record of the current time of each invocation of postfire().
        Returns:
        An enumeration of Double objects.