public class CompositeExecutionAspect extends TypedCompositeActor implements ActorExecutionAspect
Modifier and Type | Class and Description |
---|---|
static class |
CompositeExecutionAspect.CompositeExecutionAspectAttributes
Attributes for actors decorated by this CompositeExecutionAspects.
|
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.List<NamedObj> |
_actors
Actors decorated by this aspect.
|
protected java.util.List<NamedObj> |
_currentlyExecuting
List of currently executing actors.
|
protected java.util.List<ExecutionAspectListener> |
_executionAspectListeners
Listeners that want to be informed about execution events.
|
protected boolean |
_lastActorFinished
True if in the last request to schedule an actor, this actor
finished execution.
|
Parameter |
justMonitor
This parameter indicates whether the tokens received via the
ImmediateReceivers are immediately forwarded to the wrapped
receivers or whether they are delayed by this communication aspect
and only forwarded through a CommunicationResponsePort.
|
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_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 |
---|
CompositeExecutionAspect(CompositeEntity container,
java.lang.String name)
Create a new actor in the specified container with the specified
name.
|
Modifier and Type | Method and Description |
---|---|
void |
addExecutingListener(ExecutionAspectListener listener)
Add schedule listener.
|
void |
attributeChanged(Attribute attribute)
React to the change of the justMonitor attribute by
updating internal variables.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
DecoratorAttributes |
createDecoratorAttributes(NamedObj target)
Return the decorated attributes for the target NamedObj.
|
java.util.List<NamedObj> |
decoratedObjects()
Return a list of the entities deeply contained by the container
of this ExecutionAspect.
|
double |
getExecutionTime(NamedObj actor)
Get the execution time of an actor.
|
void |
initialize()
Initialize local variables.
|
void |
initializeDecoratedActors()
Iterate through all entities deeply contained by the container,
record for each that it is not executing.
|
boolean |
isGlobalDecorator()
Return true to indicate that this decorator should
decorate objects across opaque hierarchy boundaries.
|
boolean |
isWaitingForResource(Actor actor)
Check whether the execution of an actor is handled by
this aspect actor.
|
boolean |
lastScheduledActorFinished()
If the last actor that was scheduled finished execution
then this method returns true.
|
void |
notifyExecutionListeners(NamedObj entity,
java.lang.Double time,
ExecutionAspectListener.ExecutionEventType eventType)
Notify execution listeners about rescheduling events.
|
boolean |
postfire()
Iterate through resource mapping output ports and if they contain
tokens, inform the director of the actors in the tokens that these
actors can resume execution.
|
void |
removeExecutionListener(ExecutionAspectListener listener)
Remove schedule listener.
|
Time |
schedule(NamedObj actor,
Time currentPlatformTime,
Time deadline,
Time executionTime)
Schedule a new actor for execution.
|
Time |
schedule(Time environmentTime)
Perform rescheduling actions when no new actor requests to be
scheduled.
|
void |
setContainer(CompositeEntity container)
Override the base class to first set the container, then establish
a connection with any decorated objects it finds in scope in the new
container.
|
void |
setRequestPort(NamedObj actor,
java.lang.String portName)
Set the name of the port that will receive scheduling requests
for the actor.
|
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, prefire, preinitialize, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort, wrapup
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
fire, isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
getDerivedLevel, getDerivedList, propagateValue
public Parameter justMonitor
protected java.util.List<NamedObj> _actors
protected boolean _lastActorFinished
protected java.util.List<ExecutionAspectListener> _executionAspectListeners
protected java.util.List<NamedObj> _currentlyExecuting
public CompositeExecutionAspect(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor within the container.IllegalActionException
- If this actor cannot be contained
by the proposed container (see the setContainer() method).NameDuplicationException
- If the name coincides with
an entity already in the container.public void addExecutingListener(ExecutionAspectListener listener) throws IllegalActionException
addExecutingListener
in interface ActorExecutionAspect
listener
- The listener to be added.IllegalActionException
- If an error occurs in the initialization
of actors scheduled by this ExecutionAspect.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class TypedCompositeActor
attribute
- The attribute that changed.IllegalActionException
- If token in attribute cannot
be accessed.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class CompositeActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public DecoratorAttributes createDecoratorAttributes(NamedObj target)
createDecoratorAttributes
in interface Decorator
target
- The NamedObj that will be decorated.public java.util.List<NamedObj> decoratedObjects()
decoratedObjects
in interface Decorator
public double getExecutionTime(NamedObj actor) throws IllegalActionException
getExecutionTime
in interface ActorExecutionAspect
actor
- The actor.IllegalActionException
- Thrown in attribute or token cannot be read.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class CompositeActor
IllegalActionException
- Thrown if list of actors
decorated by this aspect cannot be retrieved.public void initializeDecoratedActors() throws IllegalActionException
initializeDecoratedActors
in interface ActorExecutionAspect
IllegalActionException
- If the decorator parameters cannot be read.public boolean isGlobalDecorator()
isGlobalDecorator
in interface Decorator
public boolean isWaitingForResource(Actor actor)
isWaitingForResource
in interface ActorExecutionAspect
actor
- The actor.public boolean lastScheduledActorFinished()
lastScheduledActorFinished
in interface ActorExecutionAspect
public void notifyExecutionListeners(NamedObj entity, java.lang.Double time, ExecutionAspectListener.ExecutionEventType eventType)
notifyExecutionListeners
in interface ActorExecutionAspect
entity
- Entity that is being scheduled.time
- Time when entity is being scheduled.eventType
- Type of event.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class CompositeActor
IllegalActionException
- Not explicitly thrown here.public Time schedule(Time environmentTime) throws IllegalActionException
schedule
in interface ActorExecutionAspect
environmentTime
- The outside time.IllegalActionException
- Thrown in subclasses.public Time schedule(NamedObj actor, Time currentPlatformTime, Time deadline, Time executionTime) throws IllegalActionException
schedule
in interface ActorExecutionAspect
actor
- The actor to be scheduled.currentPlatformTime
- The current platform time.deadline
- The deadline of the event.executionTime
- The execution time of the actor.IllegalActionException
- Thrown if actor parameters such
as execution time or priority cannot be read.public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException
setContainer
in class CompositeActor
container
- The container to attach this attribute to..IllegalActionException
- If this attribute is not of the
expected class for the container, or it has no name,
or the attribute and container are not in the same workspace, or
the proposed container would result in recursive containment.NameDuplicationException
- If the container already has
an attribute with the name of this attribute.ComponentEntity.getContainer()
public void setRequestPort(NamedObj actor, java.lang.String portName)
actor
- The actor.portName
- The request port.public void removeExecutionListener(ExecutionAspectListener listener)
removeExecutionListener
in interface ActorExecutionAspect
listener
- The listener to be removed.