public class Scheduler extends Attribute
A scheduler is contained by a StaticSchedulingDirector, and provides the schedule for it. The director will use this schedule to govern the execution of a CompositeActor.
A schedule is represented by the Schedule class, and determines the order of the firing of the actors in a particular composite actor. In this base class, the default schedule fires the deeply contained actors in the order of their construction. A domain specific scheduler will override this to provide a different order.
The schedule, once constructed, is cached and reused as long as the schedule is still valid. The validity of the schedule is set by the setValid() method. If the current schedule is not valid, then the schedule will be recomputed the next time the getSchedule() method is called. However, derived classes will usually override only the protected _getSchedule() method.
The scheduler does not perform any mutations, and it does not listen for changes in the model. Directors that use this scheduler should normally invalidate the schedule when mutations occur.
Schedule
Yellow (neuendor) |
Green (neuendor) |
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
_DEFAULT_SCHEDULER_NAME
The default name.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
Scheduler()
Construct a scheduler with no container(director)
in the default workspace, the name of the scheduler is
"Scheduler".
|
Scheduler(Director container,
java.lang.String name)
Construct a scheduler in the given container with the given name.
|
Scheduler(Workspace workspace)
Construct a scheduler in the given workspace with the name
"Scheduler".
|
Modifier and Type | Method and Description |
---|---|
protected Schedule |
_getSchedule()
Reschedule the model.
|
java.lang.Object |
clone(Workspace workspace)
Clone the scheduler into the specified workspace.
|
Schedule |
getSchedule()
Return the scheduling sequence as an instance of the Schedule class.
|
boolean |
isValid()
Return true if the current schedule is valid.
|
void |
setContainer(NamedObj container)
Specify the container.
|
void |
setValid(boolean valid)
Validate/invalidate the current schedule by giving a
true/false argument.
|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, 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
protected static final java.lang.String _DEFAULT_SCHEDULER_NAME
public Scheduler()
public Scheduler(Workspace workspace)
workspace
- Object for synchronization and version tracking.public Scheduler(Director container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this attribute.IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.NameDuplicationException
- If the name coincides with
an attribute already in the container.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
- If one of the attributes
cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public Schedule getSchedule() throws IllegalActionException, NotSchedulableException
IllegalActionException
- If the scheduler has no container
(a director), or the director has no container (a CompositeActor),
or the scheduling algorithm throws it.NotSchedulableException
- If the _getSchedule() method
throws it. Not thrown in this base class, but may be needed
by the derived schedulers.public boolean isValid()
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
If this method results in removing this director from a container that is a Director, then this scheduler ceases to be the active scheduler for that CompositeActor. Moreover, if the director contains any other schedulers, then the most recently added of those schedulers becomes the active scheduler.
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 scheduler and container are not in the same workspace, or
if the protected method _checkContainer() throws it.NameDuplicationException
- If the name of this scheduler
collides with a name already in the container. This will not
be thrown if the container argument is an instance of
CompositeActor.Attribute.getContainer()
public void setValid(boolean valid)
valid
- True to set the current schedule to valid.protected Schedule _getSchedule() throws IllegalActionException, NotSchedulableException
IllegalActionException
- If the scheduling algorithm
throws it. Not thrown in this base class, but may be thrown
by derived classes.NotSchedulableException
- If the CompositeActor is not
schedulable. Not thrown in this base class, but may be thrown
by derived classes.CompositeEntity.deepEntityList()