|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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
public class 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/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
protected boolean |
_postfireReturns
The value that the postfire method will return. |
private Scheduler |
_scheduler
The scheduler. |
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 | |
---|---|
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. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
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. |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean _postfireReturns
private Scheduler _scheduler
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 Debuggable
addDebugListener
in class NamedObj
listener
- The listener to which to send debug messages.removeDebugListener(DebugListener)
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 fire() throws IllegalActionException
fire
in interface Executable
fire
in class Director
IllegalActionException
- If any actor executed by this
actor return false in prefire.
InvalidStateException
- If this director does not have a
container.public Scheduler getScheduler()
setScheduler(Scheduler)
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 Executable
postfire
in class Director
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 operation. However, they should call super.prefire() if they wish to propagate time as done here.
prefire
in interface Executable
prefire
in class Director
IllegalActionException
- Not thrown in this base class.public void removeDebugListener(DebugListener listener)
removeDebugListener
in interface Debuggable
removeDebugListener
in class NamedObj
listener
- The listener to remove from the list of listeners
to which debug messages are sent.addDebugListener(DebugListener)
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.getScheduler()
protected void _setScheduler(Scheduler scheduler)
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 All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |