Class ListenFork

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

    public class ListenFork
    extends DoubleFork
    A DoubleFork actor 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 (davisj)
    Pt.ProposedRating:
    Red (davisj)
    • Constructor Detail

      • ListenFork

        public ListenFork​(CompositeEntity cont,
                          java.lang.String name)
                   throws IllegalActionException,
                          NameDuplicationException
        Construct a ListenFork actor with the specified container and name.
        Parameters:
        cont - The TypedCompositeActor that contains this actor.
        name - The name of this actor.
        Throws:
        NameDuplicationException - If the name of this actor duplicates that of an actor already contained by the container of this actor.
        IllegalActionException - If there are errors in instantiating and specifying the type of this actor's ports.
    • Method Detail

      • 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 DoubleFork
        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.
      • 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. Return true if this actor is enabled to call fire(); return false otherwise.
        Specified by:
        prefire in interface Executable
        Overrides:
        prefire in class AtomicActor<TypedIOPort>
        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.