Class TestDirector

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

    public class TestDirector
    extends AtomicActor
    This object implements a thread that obtains read permission to a workspace three times sequentially, then calls workspace.wait(obj) on an object and exits. The object "obj" on which the wait method is called is an inner class of TestWorkspace2 and has a thread of its own. This thread gets a write access on the workspace, after the TestWorkspace2 object calls wait(obj) on it. Then it gives up the write access and returns. To use it, create an instance and then call its start() method. To obtain a profile of what it did, call its profile() method. That will return only after the thread completes. NOTE: This is a very primitive test. It does not check very much.
    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    Mudit Goel, Edward A. Lee
    Pt.AcceptedRating:
    Red (mudit)
    Pt.ProposedRating:
    Green (mudit)
    • Field Detail

      • output

        public IOPort output
      • profile

        public java.lang.String profile
    • Method Detail

      • clearProfile

        public void clearProfile()
        Clear the profile accumulated till now.
      • fire

        public void fire()
                  throws IllegalActionException
        Start a thread for an instance of the inner class "Notification", obtain read access on the workspace 3 times, call wait(obj) on the workspace, ask the inner class to get a write access on the workspace and return after relinquishing the read accesses on the workspace. This method is synchronized both on this class and the inner class
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor
        Throws:
        IllegalActionException - Not thrown in this base class.
      • getProfile

        public java.lang.String getProfile()
        Return a profile which contains the various actions performed by this object.
      • postfire

        public boolean postfire()
        Description copied from class: AtomicActor
        Return true, unless stop() has been called, in which case, return false. Derived classes override this method to define operations to be performed at the end of every iteration of its execution, after one invocation of the prefire() method and any number of invocations of the fire() method. This method typically wraps up an iteration, which may involve updating local state. In derived classes, this method returns false to indicate that this actor should not be fired again.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class AtomicActor
        Returns:
        True if execution can continue into the next iteration.