Package ptolemy.actor.lib.hoc
Class CaseDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.actor.lib.hoc.CaseDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
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$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (hyzheng)
- Pt.ProposedRating:
- 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, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
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 CaseDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fire()
Fire the current refinement.Time
fireAt(Actor actor, Time time, int microstep)
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
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, attributeChanged, clone, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, initialize, invalidateResolvedTypes, invalidateSchedule, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, suspend, terminate, transferInputs, transferOutputs, transferOutputs, wrapup
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
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, int microstep) 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 classDirector
- Parameters:
actor
- The actor scheduled to be fired.time
- The scheduled time.microstep
- The microstep.- 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)
,Director.fireContainerAt(Time)
-
fire
public void fire() throws IllegalActionException
Fire the current refinement.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classDirector
- 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 classDirector
- 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 interfaceExecutable
- Overrides:
prefire
in classDirector
- 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 interfaceExecutable
- Overrides:
postfire
in classDirector
- 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.
-
-