Class ListenClock

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

    public class ListenClock
    extends Clock
    A ListenClock is a clock source that can notify an ExecEventListener of ExecEvents. In particular, the listener will be notified each time the prefire(), postfire() and wrapup() methods of this actor are invoked. Such notification is enabled by adding an ExecEventListener to this actor's listener list via the addListeners() method. Listeners can be removed via the removeListeners() method. ExecEventListeners are currently implemented to serve as conduits between Ptolemy II and the Diva graphical user interface.
    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    John S. Davis II
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Method Detail

      • prefire

        public boolean prefire()
                        throws IllegalActionException
        Generate an ExecEvent with a state value of 1, cause the calling thread to sleep for 100 milliseconds and then call the superclass prefire() method.
        Specified by:
        prefire in interface Executable
        Overrides:
        prefire in class Clock
        Returns:
        True.
        Throws:
        IllegalActionException - If there is an interruption while the calling thread sleeps.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Generate an ExecEvent with a state value of 2. Return the value of the postfire method of this actor's superclass. Return true if this actor is enabled to call fire(); return false otherwise.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class Clock
        Returns:
        True if this actor is enabled to call fire(); return false otherwise.
        Throws:
        IllegalActionException - If there is an exception with the thread activity of this method.
      • wrapup

        public void wrapup()
                    throws IllegalActionException
        Generate an ExecEvent with a state value of 3, cause the calling thread to sleep for 100 milliseconds and then call the superclass wrapup() method.
        Specified by:
        wrapup in interface Initializable
        Overrides:
        wrapup in class Clock
        Throws:
        IllegalActionException - If there is an exception in the execution of the wrapup method of this actor's superclass.