|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.actor.sched.StaticSchedulingDirector
A director that uses static scheduling to govern the execution of the CompositeActor it belongs to.
This class does not directly implement a scheduling algorithm, but defers to its contained scheduler. The contained scheduler creates an instance of the Schedule class which determines the number of times each actor should be fired and their firing order. This allows new scheduling algorithms to be easily created for existing domains.
This class is generally useful for statically scheduled domains where a schedule can be constructed once and used to repeatedly execute the model. The Scheduler class caches the schedule until the model changes so that the schedule does not have to be recomputed.
Director,
Scheduler,
Schedule,
Serialized Form
| Yellow (neuendor) |
| Green (neuendor) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Field Summary |
| Fields inherited from class ptolemy.actor.Director |
_currentTime, _stopRequested |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Fields inherited from interface ptolemy.actor.Executable |
COMPLETED, NOT_READY, STOP_ITERATING |
| Constructor Summary | |
StaticSchedulingDirector()
Construct a director in the default workspace with an empty string as its name. |
|
StaticSchedulingDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
|
StaticSchedulingDirector(Workspace workspace)
Construct a director in the workspace with an empty name. |
|
| Method Summary | |
protected void |
_setScheduler(Scheduler scheduler)
Set the local scheduler for execution of this Director. |
void |
addDebugListener(DebugListener listener)
Override the base class to also listen to the scheduler, if there is one. |
void |
fire()
Calculate the current schedule, if necessary, and iterate the contained actors in the order given by the schedule. |
Scheduler |
getScheduler()
Return the scheduler that is responsible for scheduling the directed actors. |
void |
invalidateSchedule()
Indicate that a schedule for the model may no longer be valid. |
boolean |
isScheduleValid()
Return true if the current (cached) schedule is valid. |
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 |
removeDebugListener(DebugListener listener)
Override the base class to also remove the listener from the scheduler, if there is one. |
void |
setScheduler(Scheduler scheduler)
Set the scheduler for this StaticSchedulingDirector. |
void |
setScheduleValid(boolean valid)
Validate/Invalidate the schedule. |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, clone, getContainer, setName |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public StaticSchedulingDirector()
public StaticSchedulingDirector(Workspace workspace)
workspace - The workspace of this object.
public StaticSchedulingDirector(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container of this director.name - Name of this director.
IllegalActionException - Not thrown in this base class.
May be thrown in the derived classes if the director
is not compatible with the specified container.
NameDuplicationException - If the name collides with
an attribute that already exists in the given container.| Method Detail |
public void addDebugListener(DebugListener listener)
addDebugListener in interface DebuggableaddDebugListener in class NamedObjlistener - The listener to which to send debug messages.
public void fire()
throws IllegalActionException
Iterating an actor involves calling the actor's iterate() method, which is equivalent to calling the actor's prefire(), fire() and postfire() methods in succession. If iterate() returns NOT_READY, indicating that the actor is not ready to execute, then an IllegalActionException will be thrown. The values returned from iterate() are recorded and are used to determine the value that postfire() will return at the end of the director's iteration.
This method may be overridden by some domains to perform additional domain-specific operations.
fire in interface Executablefire in class DirectorIllegalActionException - If any actor executed by this
actor return false in prefire.
InvalidStateException - If this director does not have a
container.public Scheduler getScheduler()
public void invalidateSchedule()
invalidateSchedule in class Director
public boolean isScheduleValid()
throws IllegalActionException
IllegalActionException - If there's no scheduler.
public boolean postfire()
throws IllegalActionException
postfire in interface Executablepostfire in class DirectorIllegalActionException - 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 operation. However, they should call super.prefire() if they wish to propagate time as done here.
prefire in interface Executableprefire in class DirectorIllegalActionException - Not thrown in this base class.public void removeDebugListener(DebugListener listener)
removeDebugListener in interface DebuggableremoveDebugListener in class NamedObjlistener - The listener to remove from the list of listeners
to which debug messages are sent.
public void setScheduleValid(boolean valid)
throws IllegalActionException
valid - True if the schedule is to be marked valid.
IllegalActionException - If there's no scheduler.
public void setScheduler(Scheduler scheduler)
throws IllegalActionException,
NameDuplicationException
scheduler - The scheduler that this director will use.
IllegalActionException - Not thrown in this base class,
but derived classes may throw it if the scheduler is not compatible.
NameDuplicationException - Not thrown in this base class,
but derived classes may throw it if the scheduler is not compatible.
protected void _setScheduler(Scheduler scheduler)
throws IllegalActionException,
NameDuplicationException
scheduler - The Scheduler responsible for execution.
IllegalActionException - Not thrown in this base class,
but derived classes may throw it if the scheduler is not compatible.
NameDuplicationException - Not thrown in this base class,
but derived classes may throw it if the scheduler is not compatible.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||