Package ptolemy.domains.pn.kernel.test
Class TestDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor
-
- ptolemy.domains.pn.kernel.test.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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description IOPort
input
IOPort
output
java.lang.String
profile
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description TestDirector(CompositeActor container, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearProfile()
Clear the profile accumulated till now.void
fire()
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.java.lang.String
getProfile()
Return a profile which contains the various actions performed by this object.boolean
postfire()
Return true, unless stop() has been called, in which case, return false.-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newPort, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
TestDirector
public TestDirector(CompositeActor container, java.lang.String name) throws NameDuplicationException, IllegalActionException
-
-
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 interfaceExecutable
- Overrides:
fire
in classAtomicActor
- 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 interfaceExecutable
- Overrides:
postfire
in classAtomicActor
- Returns:
- True if execution can continue into the next iteration.
-
-