public class Director extends Attribute implements Executable
A top-level composite actor is generally associated with a manager as well as a local director. The Manager has overall responsibility for executing the application, and is often associated with a GUI. Top-level composite actors have no executive director and getExecutiveDirector() will return null.
A local director is responsible for invoking the actors contained by the composite. If there is no local director, then the executive director is given the responsibility. The getDirector() method of CompositeActor, therefore, returns the local director, if there is one, and otherwise returns the executive director. Thus, it returns whichever director is responsible for executing the contained actors, or null if there is none. Whatever it returns is called simply the director (vs. local director or executive director).
A director implements the action methods (preinitialize(), initialize(), prefire(), fire(), postfire(), iterate(), and wrapup()). In this base class, default implementations are provided that may or may not be useful in specific domains. In general, these methods will perform domain-dependent actions, and then call the respective methods in all contained actors.
The director also provides methods to optimize the iteration portion of an execution. This is done by setting the workspace to be read-only during an iteration. In this base class, the default implementation results in a read/write workspace. Derived classes (e.g. domain specific directors) should override the _writeAccessRequired() method to report that write access is not required. If none of the directors in a simulation require write access, then it is safe to set the workspace to be read-only, which will result in faster execution.
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.Set |
_actorsFinishedExecution
Set of actors that have returned false from postfire(),
indicating that they do not wish to be iterated again.
|
protected java.util.HashMap<NamedObj,ActorExecutionAspect> |
_aspectForActor
Contains a map of actors and the ExecutionAspect that is specified for the actor.
|
protected boolean |
_aspectsPresent
True if any of the directed actors specifies a ExecutionAspect
in the parameters and this ExecutionAspect exists on this or
a hierarchy level above (i.e. has not been deleted).
|
protected int |
_defaultMicrostep
The director's default microstep.
|
protected java.util.List<ActorExecutionAspect> |
_executionAspects
ExecutionAspects in the container of this director.
|
protected boolean |
_finishRequested
Indicator that finish() has been called.
|
protected java.util.Set<Initializable> |
_initializables
Set of objects whose (pre)initialize() and wrapup() methods
should be slaved to these.
|
protected java.util.HashMap<ActorExecutionAspect,Time> |
_nextScheduleTime
Next time the aspect wants to be executed.
|
protected boolean |
_stopRequested
Indicator that a stop has been requested by a call to stop().
|
protected boolean |
_tokenSentToCommunicationAspect
Flag set to true if a token has been sent to a communication aspect
by any port/receiver where the aspect is enabled.
|
protected Time |
_zeroTime
Time with value 0.0.
|
LocalClock |
localClock
The clock that keeps track of current time of the model.
|
Parameter |
startTime
The local time of model when this director is initialized.
|
Parameter |
stopTime
The stop time of the model.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
Director()
Construct a director in the default workspace with an empty string
as its name.
|
Director(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name.
|
Director(Workspace workspace)
Construct a director in the workspace with an empty name.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
_actorFinished(NamedObj actor)
Return true if the actor finished execution.
|
protected Time |
_consultTimeRegulators(Time proposedTime)
Consult all attributes contained by the container of this director
that implement the
TimeRegulator interface, if any, and return the
smallest time returned by those regulators. |
protected java.lang.String |
_description(int detail,
int indent,
int bracket)
Return a description of the object.
|
protected boolean |
_isEmbedded()
Deprecated.
Use
isEmbedded() instead |
protected boolean |
_isTopLevel()
Return true if this is a top-level director, or if it should
always be handled as if it were a top-level director.
|
protected boolean |
_schedule(NamedObj actor,
Time timestamp)
Schedule an actor for execution on a ExecutionAspect.
|
protected boolean |
_transferInputs(IOPort port)
Transfer at most one data token from the given input port of
the container to the ports it is connected to on the inside.
|
protected boolean |
_transferOutputs(IOPort port)
Transfer at most one data token from the given output port of
the container to the ports it is connected to on the outside..
|
void |
addInitializable(Initializable initializable)
Add the specified object to the set of objects whose
preinitialize(), initialize(), and wrapup()
methods should be invoked upon invocation of the corresponding
methods of this object.
|
void |
attributeChanged(Attribute attribute)
Override the base class to update local variables.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
void |
createSchedule()
Create the schedule for this director, if necessary.
|
Dependency |
defaultDependency()
Return a default dependency to use between input
ports and output ports.
|
Dependency |
delayDependency(double delay)
Return a boolean dependency representing a model-time delay
of the specified amount.
|
long |
elapsedTimeSinceStart()
Return the elapsed time (in milliseconds) since the start of execution
of the model.
|
void |
finish()
Request that after the current iteration finishes postfire() returns
false, indicating to the environment that no more iterations should
be invoked.
|
void |
fire()
Iterate all the deeply contained actors of the
container of this director exactly once.
|
void |
fireAt(Actor actor,
double time)
Deprecated.
Instead of using double as time argument, use a
time object instead. As of Ptolemy 4.1, replaced by
fireAt(Actor, Time) |
Time |
fireAt(Actor actor,
Time time)
Request a firing of the given actor at the given model
time.
|
Time |
fireAt(Actor actor,
Time time,
int microstep)
Request a firing of the given actor at the given model
time with the given microstep.
|
Time |
fireAtCurrentTime(Actor actor)
Request a firing of the given actor at the current model time or later.
|
Time |
fireContainerAt(Time time)
Request a firing of the container of this director at the specified time
and throw an exception if the executive director does not agree to
do it at the requested time.
|
Time |
fireContainerAt(Time time,
int microstep)
Request a firing of the container of this director at the specified time,
adjusted by the current offset and drift of the local clock,
and the specified microstep.
|
CausalityInterface |
getCausalityInterface()
Return a causality interface for the composite actor that
contains this director.
|
double |
getCurrentTime()
Deprecated.
As of Ptolemy II 4.1, replaced by
getModelTime() |
Time |
getDeadline(NamedObj actor,
Time timestamp)
Compute the deadline for an actor firing.
|
Time |
getEnvironmentTime()
Get current environment time.
|
ActorExecutionAspect |
getExecutionAspect(NamedObj actor)
Find the ExecutionAspect for the actor.
|
Time |
getGlobalTime()
Return the global time for this model.
|
Time |
getModelNextIterationTime()
Return the next time of interest in the model being executed by
this director or the director of any enclosing model up the
hierarchy.
|
Time |
getModelStartTime()
Return the start time parameter value, if it has been explicitly
set.
|
Time |
getModelStopTime()
Return the stop time parameter value, if it has been set,
and otherwise, return a time with value Double.POSITIVE_INFINITY.
|
Time |
getModelTime()
Return the current time object of the model being executed by this
director.
|
double |
getNextIterationTime()
Deprecated.
As of Ptolemy II 4.1, replaced by
getModelNextIterationTime() |
double |
getStartTime()
Deprecated.
As of Ptolemy II 4.1, replaced by
getModelStartTime() |
double |
getStopTime()
Deprecated.
As of Ptolemy II 4.1, replaced by
getModelStopTime() |
double |
getTimeResolution()
Get the time resolution of the model.
|
boolean |
implementsStrictActorSemantics()
Return true if this director assumes and exports
the strict actor semantics, as described in this paper:
A.
|
void |
initialize()
Initialize the model controlled by this director.
|
void |
initialize(Actor actor)
Initialize the given actor.
|
void |
invalidateResolvedTypes()
Indicate that resolved types in the model may no longer be valid.
|
void |
invalidateSchedule()
Indicate that a schedule for the model may no longer be valid, if
there is a schedule.
|
boolean |
isEmbedded()
Return true if this director is embedded inside an opaque composite
actor contained by another composite actor.
|
boolean |
isFireFunctional()
Return false.
|
boolean |
isStopRequested()
Return true if stop has been requested.
|
boolean |
isStrict()
Return true.
|
int |
iterate(int count)
Invoke a specified number of iterations of this director.
|
java.lang.Object |
mutexLockObject()
Return the object to use to obtain a mutex lock on this director.
|
Receiver |
newReceiver()
Return a new receiver of a type compatible with this director.
|
void |
notifyTokenSentToCommunicationAspect()
Notify this director that a token was sent to a communication
aspect.
|
boolean |
postfire()
Return true if the director wishes to be scheduled for another
iteration.
|
boolean |
prefire()
Return true if the director is ready to fire.
|
void |
preinitialize()
Validate the attributes and then invoke the preinitialize()
methods of all its deeply contained actors.
|
void |
preinitialize(Actor actor)
Preinitialize the actor.
|
void |
removeInitializable(Initializable initializable)
Remove the specified object from the list of objects whose
preinitialize(), initialize(), and wrapup()
methods should be invoked upon invocation of the corresponding
methods of this object.
|
void |
requestInitialization(Actor actor)
Queue an initialization request with the manager.
|
void |
resume()
Start or resume the actor, which means (re)start the local clock.
|
void |
resumeActor(NamedObj actor)
Resume the execution of an actor that was previously blocked because
it didn't have all the resources it needed for execution.
|
boolean |
scheduleContainedActors()
Return true if the next actor in the model governed by this director
can be scheduled.
|
void |
setContainer(NamedObj container)
Specify the container.
|
void |
setCurrentTime(double newTime)
Deprecated.
As of Ptolemy 4.1, replaced by
setModelTime(ptolemy.actor.util.Time) |
void |
setEmbedded(boolean force)
With a false argument, force this director to behave as if it is
a top-level director even if it is not.
|
void |
setModelTime(Time newTime)
Set a new value to the current time of the model.
|
void |
setTimeResolution(double timeResolution)
Set time resolution.
|
void |
stop()
Request that the director cease execution altogether.
|
void |
stopFire()
Request that execution of the current iteration stop.
|
java.lang.String[] |
suggestedModalModelDirectors()
Return an array of suggested directors to be used with
ModalModel.
|
boolean |
supportMultirateFiring()
Return a boolean to indicate whether a ModalModel under control
of this director supports multirate firing.
|
void |
suspend()
Suspend the actor at the specified time.
|
void |
terminate()
Terminate any currently executing model with extreme prejudice.
|
boolean |
transferInputs(IOPort port)
Transfer data from an input port of the container to the ports
it is connected to on the inside.
|
void |
transferOutputs()
Transfer data from all output ports of the container to the
ports they are connected to on the outside.
|
boolean |
transferOutputs(IOPort port)
Transfer data from an output port of the container to the
ports it is connected to on the outside.
|
void |
wrapup()
Invoke the wrapup() method of all the actors contained in the
director's container.
|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_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
public LocalClock localClock
public Parameter startTime
public Parameter stopTime
postfire()
returns false.protected java.util.Set _actorsFinishedExecution
protected java.util.HashMap<NamedObj,ActorExecutionAspect> _aspectForActor
protected boolean _aspectsPresent
protected int _defaultMicrostep
protected java.util.List<ActorExecutionAspect> _executionAspects
protected boolean _finishRequested
protected transient java.util.Set<Initializable> _initializables
protected java.util.HashMap<ActorExecutionAspect,Time> _nextScheduleTime
protected boolean _tokenSentToCommunicationAspect
protected boolean _stopRequested
protected Time _zeroTime
public Director() throws IllegalActionException, NameDuplicationException
NameDuplicationException
- If construction of Time objects fails.IllegalActionException
- If construction of Time objects fails.public Director(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this director.IllegalActionException
- If the name has a period in it, or
the director is not compatible with the specified container, or if
the time resolution parameter is malformed.NameDuplicationException
- If the container already contains
an entity with the specified name.public Director(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace
- The workspace of this object.NameDuplicationException
- If construction of Time objects fails.IllegalActionException
- If construction of Time objects fails.public void addInitializable(Initializable initializable)
addInitializable
in interface Initializable
initializable
- The object whose methods should be invoked.removeInitializable(Initializable)
,
CompositeActor.addPiggyback(Executable)
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If timeResolution is
being changed and the model is executing (and not in
preinitialize()).public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Attribute
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void createSchedule() throws IllegalActionException
IllegalActionException
- If the schedule can't be created.public Dependency defaultDependency()
BooleanDependency
.OTIMES_IDENTITY.Dependency
,
CausalityInterface
,
Actor.getCausalityInterface()
public Dependency delayDependency(double delay)
delay
- A non-negative delay.public long elapsedTimeSinceStart()
public void finish()
public void fire() throws IllegalActionException
This method is not synchronized on the workspace, so the caller should be.
In this base class, an attempt is made to fire each actor exactly once, in the order they were created. Prefire is called once, and if prefire returns true, then fire is called once, followed by postfire. The return value from postfire is ignored. If the container is not an instance of CompositeActor, however, then this method does nothing.
fire
in interface Executable
IllegalActionException
- If any called method of one
of the associated actors throws it.@Deprecated public void fireAt(Actor actor, double time) throws IllegalActionException
fireAt(Actor, Time)
fireAt(Actor, Time)
method.actor
- The actor scheduled to be fired.time
- The scheduled time.IllegalActionException
- If the operation is not
permissible (e.g. the given time is in the past).public Time fireAt(Actor actor, Time time) throws IllegalActionException
fireContainerAt(Time, int)
with the microstep argument set to 1.
The intent of this method is to request a firing of the actor at the specified time, but this implementation does not assure that. In particular, if there is no executive director, it completely ignores the request. If there is an executive director, then it is not required to do the firing at the specified time. In particular, derived classes may override this method and modify the time of the firing, for example to prevent attempts to fire an actor in the past.
Derived classes should override this method to return the time at which they expect to fire the specified actor. It is up to the actor to throw an exception if it is not acceptable for the time to differ from the requested time.
Note that it is not correct behavior for a director to override this method to simply fire the specified actor. The actor needs to be fired as part of the regular execution cycle of that director, and that needs to occur after this method has returned.
Note to authors of subclasses: Usually you should not
override this method, but rather override
fireAt(Actor, Time, int)
. However, we cannot make
this method final because occasionally a domain will change the
default starting microstep. E.g., DE does this.
actor
- The actor scheduled to be fired.time
- The requested time.IllegalActionException
- If there is an executive director
and it throws it. Derived classes may choose to throw this
exception for other reasons.fireAtCurrentTime(Actor)
public Time fireAt(Actor actor, Time time, int microstep) throws IllegalActionException
fireAt(Actor, Time)
, except that it also
passes up to the executive director the microstep, if there
is one.
This default implementation just delegates to
fireContainerAt(Time, int)
actor
- The actor scheduled to be fired.time
- The requested time.microstep
- The requested microstep.IllegalActionException
- If there is an executive director
and it throws it. Derived classes may choose to throw this
exception for other reasons.fireAtCurrentTime(Actor)
,
fireContainerAt(Time)
public Time fireAtCurrentTime(Actor actor) throws IllegalActionException
Note that it is not correct behavior for a director to override this method to simply fire the specified actor. The actor needs to be fired as part of the regular execution cycle of that director, and that needs to occur after this method has returned.
actor
- The actor to be fired.IllegalActionException
- If this method is called
before the model is running.fireAt(Actor, Time)
public Time fireContainerAt(Time time) throws IllegalActionException
time
- The requested time.IllegalActionException
- If the director does not
agree to fire the actor at the specified time, or if there
is no director.public Time fireContainerAt(Time time, int microstep) throws IllegalActionException
SuperdenseTimeDirector
.time
- The requested time.microstep
- The requested microstep.IllegalActionException
- If the director does not
agree to fire the actor at the specified time, or if there
is no director.public boolean scheduleContainedActors() throws IllegalActionException
IllegalActionException
- not thrown here.public CausalityInterface getCausalityInterface()
CausalityInterfaceForComposites
, but
subclasses may override this to return a domain-specific
causality interface.@Deprecated public double getCurrentTime()
getModelTime()
setCurrentTime(double)
public Time getDeadline(NamedObj actor, Time timestamp) throws IllegalActionException
actor
- The actor.timestamp
- The timestamp of the event that triggered the firing.IllegalActionException
- Thrown in subclasses.public Time getEnvironmentTime()
public Time getGlobalTime() throws IllegalActionException
IllegalActionException
- If the top level is not an Actor.public Time getModelNextIterationTime() throws IllegalActionException
This method is useful for domains that perform speculative execution (such as CT). Such a domain in a hierarchical model (i.e. CT inside DE) uses this method to determine how far into the future to execute.
Derived classes should override this method to provide an appropriate value, if possible. For example, the DEDirector class returns the time value of the next event in the event queue.
IllegalActionException
- If time objects cannot be created.getModelTime()
public final Time getModelStartTime() throws IllegalActionException
IllegalActionException
- If the executive director throws it.public final Time getModelStopTime()
public Time getModelTime()
setModelTime(Time)
@Deprecated public double getNextIterationTime() throws IllegalActionException
getModelNextIterationTime()
In this base class, we return the current time. Derived classes should override this method to provide an appropriate value, if possible.
Note that this method is not made abstract to facilitate the use of the test suite.
IllegalActionException
- If Time objects cannot be created.@Deprecated public double getStartTime() throws IllegalActionException
getModelStartTime()
IllegalActionException
- If the specified start time
is invalid.@Deprecated public double getStopTime() throws IllegalActionException
getModelStopTime()
IllegalActionException
- If the specified stop time
is invalid.public final double getTimeResolution()
setTimeResolution(double)
public boolean implementsStrictActorSemantics()
A. Goderis, C. Brooks, I. Altintas, E. A. Lee, and C. Goble, "Heterogeneous Composition of Models of Computation," EECS Department, University of California, Berkeley, Tech. Rep. UCB/EECS-2007-139, Nov. 2007. http://www.eecs.berkeley.edu/Pubs/TechRpts/2007/EECS-2007-139.html
In particular, a director that implements this interface guarantees that it will not invoke the postfire() method of an actor until all its inputs are known at the current tag. Moreover, it it will only do so in its own postfire() method, and in its prefire() and fire() methods, it does not change its own state. Thus, such a director can be used within a model of computation that has a fixed-point semantics, such as SRDirector and ContinuousDirector. This base class returns false.
public void initialize() throws IllegalActionException
initialize
in interface Initializable
IllegalActionException
- If the initialize() method of
one of the associated actors throws it.public void initialize(Actor actor) throws IllegalActionException
actor
- The actor that is to be initialized.IllegalActionException
- If the actor is not
acceptable to the domain. Not thrown in this base class.public void resumeActor(NamedObj actor) throws IllegalActionException
ActorExecutionAspect
actors.
In this base class, the implementation is empty. Derived directors
should override this method to handle resuming of actor execution.actor
- The actor that resumes execution.IllegalActionException
- Not thrown here but in derived classes.public void invalidateResolvedTypes()
public void invalidateSchedule()
public final boolean isEmbedded()
setEmbedded(boolean)
public boolean isFireFunctional()
isFireFunctional
in interface Executable
public boolean isStrict() throws IllegalActionException
isStrict
in interface Executable
IllegalActionException
- Thrown by subclass.public boolean isStopRequested()
stop()
public int iterate(int count) throws IllegalActionException
This base class method actually invokes prefire(), fire(), and postfire(), as described above, but a derived class may override the method to execute more efficient code.
iterate
in interface Executable
count
- The number of iterations to perform.IllegalActionException
- If iterating is not
permitted, or if prefire(), fire(), or postfire() throw it.public java.lang.Object mutexLockObject()
public Receiver newReceiver()
public void notifyTokenSentToCommunicationAspect()
public boolean postfire() throws IllegalActionException
In this base class, return the false if stop() has been called since preinitialize(), and true otherwise. Derived classes that override this method need to respect this semantics. The protected variable _stopRequested indicates whether stop() has been called.
postfire
in interface Executable
IllegalActionException
- Not thrown in this base class.public boolean prefire() throws IllegalActionException
In this base class, assume that the director is always ready to be fired, and so return true. Domain directors should probably override this method to provide domain-specific behavior. However, they should call super.prefire() if they wish to propagate time as done here.
prefire
in interface Executable
IllegalActionException
- Not thrown in this base class.public void preinitialize() throws IllegalActionException
This method also resets the protected variable _stopRequested to false, so if a derived class overrides this method, then it should also do that.
This method is not synchronized on the workspace, so the caller should be.
preinitialize
in interface Initializable
IllegalActionException
- If the preinitialize() method of
one of the associated actors throws it.public void preinitialize(Actor actor) throws IllegalActionException
preinitialize()
calls this method.actor
- The actor to be preinitialized.IllegalActionException
- If thrown while the actor is being
preinitialized.preinitialize()
public void removeInitializable(Initializable initializable)
removeInitializable
in interface Initializable
initializable
- The object whose methods should no longer be invoked.addInitializable(Initializable)
,
CompositeActor.removePiggyback(Executable)
public void requestInitialization(Actor actor)
actor
- The actor to initialize.public void resume() throws IllegalActionException
IllegalActionException
- If the fireAt() request throws it.public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
If this method results in removing this director from a container that is a CompositeActor, then this director ceases to be the active director for that CompositeActor. Moreover, if the composite actor contains any other directors, then the most recently added of those directors becomes the active director.
This method is write-synchronized to the workspace and increments its version number.
setContainer
in class Attribute
container
- The proposed container.IllegalActionException
- If the action would result in a
recursive containment structure, or if
this director and container are not in the same workspace, or
if the protected method _checkContainer() throws it.NameDuplicationException
- If the name of this director
collides with a name already in the container. This will not
be thrown if the container argument is an instance of
CompositeActor.Attribute.getContainer()
@Deprecated public void setCurrentTime(double newTime) throws IllegalActionException
setModelTime(ptolemy.actor.util.Time)
newTime
- The new current simulation time.IllegalActionException
- If the new time is less than
the current time returned by getCurrentTime().getCurrentTime()
public final void setEmbedded(boolean force)
force
- False to force this director to behave as if it were
not embedded.isEmbedded()
public void setModelTime(Time newTime) throws IllegalActionException
newTime
- The new current simulation time.IllegalActionException
- If the new time is less than
the current time returned by getCurrentTime().getModelTime()
public void setTimeResolution(double timeResolution)
timeResolution
- The new time resolution.getTimeResolution()
public void stop()
The stop() method requests immediate stopping. To give determinate stopping, call finish() so that the current iteration is completed.
In multithreaded domains, Director.stopFire() is called to request that all actors conclude ongoing firings.
stop
in interface Executable
public void stopFire()
stopFire
in interface Executable
public java.lang.String[] suggestedModalModelDirectors()
public boolean supportMultirateFiring()
public void suspend()
public void terminate()
This base class recursively calls terminate() on all actors deeply contained by the container of this director. Derived classes should override this method to release all resources in use and kill any sub-threads. Derived classes should not synchronize this method because it should execute as soon as possible. If the container is not an instance of CompositeActor, then this method does nothing.
terminate
in interface Executable
public boolean transferInputs(IOPort port) throws IllegalActionException
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
input port.public void transferOutputs() throws IllegalActionException
transferOutputs(IOPort)
to actually do the transfer.
Override this method if you need to change the order in which
the transfers occur.IllegalActionException
- Not thrown in this base class.public boolean transferOutputs(IOPort port) throws IllegalActionException
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
output port.public void wrapup() throws IllegalActionException
This method should be invoked once per execution. None of the other action methods should be invoked after it in the execution. This method is not synchronized on the workspace, so the caller should be.
wrapup
in interface Initializable
IllegalActionException
- If the wrapup() method of
one of the associated actors throws it.protected boolean _actorFinished(NamedObj actor)
actor
- The actor.protected Time _consultTimeRegulators(Time proposedTime) throws IllegalActionException
TimeRegulator
interface, if any, and return the
smallest time returned by those regulators. If there are no such
attributes, return the proposedTime argument.proposedTime
- The time proposed.IllegalActionException
- If a time regulator throws it.protected java.lang.String _description(int detail, int indent, int bracket) throws IllegalActionException
_description
in class NamedObj
detail
- The level of detail.indent
- The amount of indenting.bracket
- The number of surrounding brackets (0, 1, or 2).IllegalActionException
- If thrown while getting the
description of subcomponents.@Deprecated protected boolean _isEmbedded()
isEmbedded()
insteadprotected boolean _isTopLevel()
public ActorExecutionAspect getExecutionAspect(NamedObj actor) throws IllegalActionException
actor
- The actor to be scheduled.IllegalActionException
- If thrown while getting the
enable token or the decorator.protected boolean _transferInputs(IOPort port) throws IllegalActionException
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
input port.IOPort.transferInputs()
protected boolean _transferOutputs(IOPort port) throws IllegalActionException
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
output portprotected boolean _schedule(NamedObj actor, Time timestamp) throws IllegalActionException
actor
- The actor.timestamp
- The time the actor requests to be scheduled.IllegalActionException
- Thrown if parameters cannot be read, actor cannot be
scheduled or container cannot be fired at future time.