ptolemy.actor.lib.hoc
Class CaseDirector

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.Director
              extended by ptolemy.actor.lib.hoc.CaseDirector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Executable, Initializable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
CTCaseDirector

public class CaseDirector
extends Director

An CaseDirector governs the execution of a Case actor. This director simply delegates to the refinement whose name matches the value of the current control input.

Since:
Ptolemy II 5.2
Version:
$Id: CaseDirector.java 57046 2010-01-27 23:35:53Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (hyzheng)
Proposed Rating:
Yellow (eal)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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
CaseDirector(CompositeEntity container, java.lang.String name)
          Construct a director in the given container with the given name.
 
Method Summary
 void fire()
          Fire the current refinement.
 Time fireAt(Actor actor, Time time)
          Schedule a firing of the given actor at the given time.
 Receiver newReceiver()
          Return a receiver that is a one-place buffer.
 boolean postfire()
          Invoke the postfire() method of the current local director.
 boolean prefire()
          Read the control token input, transfer input tokens, and invoke prefire() of the selected refinement.
 
Methods inherited from class ptolemy.actor.Director
_description, _fireContainerAt, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, attributeChanged, createSchedule, defaultDependency, finish, fireAt, fireAtCurrentTime, getCausalityInterface, getCurrentTime, getErrorTolerance, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, initialize, invalidateResolvedTypes, invalidateSchedule, isFireFunctional, isStopRequested, isStrict, iterate, preinitialize, preinitialize, removeInitializable, requestInitialization, setContainer, setCurrentTime, setModelTime, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, terminate, transferInputs, transferOutputs, wrapup
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseDirector

public CaseDirector(CompositeEntity container,
                    java.lang.String name)
             throws IllegalActionException,
                    NameDuplicationException
Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace.

Parameters:
container - Container of this director.
name - Name of this director.
Throws:
IllegalActionException - If the name has a period in it, or the director is not compatible with the specified container.
NameDuplicationException - If the container not a CompositeActor and the name collides with an entity in the container.
Method Detail

fireAt

public Time fireAt(Actor actor,
                   Time time)
            throws IllegalActionException
Schedule a firing of the given actor at the given time. If there is an executive director, this method delegates to it. Otherwise, it sets its own notion of current time to that specified in the argument. The reason for this is to enable Case to be a top-level actor and to support the design pattern where a director requests a refiring at the next time it wishes to be awakened, just prior to returning from fire(). DEDirector, for example, does that, as does the SDFDirector if the period parameter is set.

Overrides:
fireAt in class Director
Parameters:
actor - The actor scheduled to be fired.
time - The scheduled time.
Returns:
The time returned by the executive director, or or the specified time if there isn't one.
Throws:
IllegalActionException - If by the executive director.
See Also:
Director.fireAtCurrentTime(Actor)

fire

public void fire()
          throws IllegalActionException
Fire the current refinement.

Specified by:
fire in interface Executable
Overrides:
fire in class Director
Throws:
IllegalActionException - If refinement throws it.

newReceiver

public Receiver newReceiver()
Return a receiver that is a one-place buffer. A token put into the receiver will overwrite any token already in the receiver.

Overrides:
newReceiver in class Director
Returns:
A receiver that is a one-place buffer.

prefire

public boolean prefire()
                throws IllegalActionException
Read the control token input, transfer input tokens, and invoke prefire() of the selected refinement.

Specified by:
prefire in interface Executable
Overrides:
prefire in class Director
Returns:
True.
Throws:
IllegalActionException - If there is no director, or if the director's prefire() method throws it, or if this actor is not opaque.

postfire

public boolean postfire()
                 throws IllegalActionException
Invoke the postfire() method of the current local director.

Specified by:
postfire in interface Executable
Overrides:
postfire in class Director
Returns:
True if the execution can continue into the next iteration.
Throws:
IllegalActionException - If there is no director, or if the director's postfire() method throws it, or if this actor is not opaque.