|
|||||||||
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.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.kernel.CompositeEntity
ptolemy.actor.CompositeActor
ptolemy.actor.TypedCompositeActor
ptolemy.domains.ddf.lib.ActorRecursion
public class ActorRecursion
This actor performs actor recursion dynamically during execution. Upon firing, it clones the composite actor which contains itself and is referred to by the StringParameter recursionActor. It then places the clone inside itself and connects the corresponding ports of both actors. It uses a local DDFDirector to preinitialize the clone and then transfers all tokens contained by input ports of this actor to the connected opaque ports inside. It again uses the local DDFDirector to initialize all actors contained by this actor and classifies each of them such as their enabling and deferrable status. It then transfers all tokens contained by output ports of this actor to the connected opaque ports outside. It finally merges the local DDFDirector with its executive DDFDirector and then removes the local DDFDirector. Thus during execution this actor is fired at most once, after which the executive director directly controls all actors inside. Since there is no type constraint between input ports and output ports of this actor, users have to manually configure types for all outputs of this actor.
Yellow (cxh) |
Yellow (zgang) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity |
---|
CompositeEntity.ContainedObjectsIterator |
Field Summary | |
---|---|
private java.util.HashMap |
_inputTokensHolder
A HashMap to store tokens of the input ports. |
private boolean |
_isCompatibilityChecked
A flag indicating if the compatibility of the to-be-cloned composite actor has been checked. |
private CompositeActor |
_recursionActor
The composite actor to be cloned. |
StringParameter |
recursionActor
A StringParameter representing the name of the composite actor to clone from. |
Fields inherited from class ptolemy.actor.CompositeActor |
---|
_actorFiringListeners, _causalityInterface, _initializables, _notifyingActorFiring, _publishedPorts, _publisherRelations, _stopRequested |
Fields inherited from class ptolemy.kernel.CompositeEntity |
---|
_levelCrossingLinks |
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 | |
---|---|
ActorRecursion(CompositeEntity container,
java.lang.String name)
Create an ActorRecursion with a name and a container. |
Method Summary | |
---|---|
private void |
_checkCompatibility()
Check the compatibility of the to-be-cloned composite actor with this actor. |
private void |
_cloneRecursionActor()
Clone the composite actor into the same workspace as this actor. |
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description of the contents of this object. |
protected void |
_finishedAddEntity(ComponentEntity entity)
Notify this actor that the given entity has been added inside it. |
private int |
_getTokenConsumptionRate(Receiver receiver)
Get token consumption rate for the given receiver. |
private void |
_searchRecursionActor()
Get the to-be-cloned composite actor's name from StringParameter recursionActor. |
private void |
_setOutputPortRate()
Read the rate parameters of the input ports of all actors receiving tokens from this actor and propagate these parameters back to the connected output ports of this actor. |
private void |
_transferInputs()
Transfer all tokens contained by input ports of this actor and stored by an internal variable to the connected opaque ports inside. |
private void |
_transferOutputs()
Transfer all tokens contained by output ports of this actor to the connected opaque ports outside.We cannot use transferOutputs(IOPort) of the local director because we have to transfer all tokens instead of those specified by rate parameters because all output ports will become transparent after this firing. |
void |
fire()
Clone the composite actor referred to by the StringParameter recursionActor into itself. |
void |
initialize()
Initialize this actor. |
boolean |
postfire()
Override the base class to return false. |
Methods inherited from class ptolemy.actor.TypedCompositeActor |
---|
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.actor.Actor |
---|
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, preinitialize, removeInitializable, wrapup |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
public StringParameter recursionActor
private CompositeActor _recursionActor
private boolean _isCompatibilityChecked
private java.util.HashMap _inputTokensHolder
Constructor Detail |
---|
public ActorRecursion(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container actor.name
- The name of this actor.
IllegalActionException
- If the container is incompatible
with this actor.
NameDuplicationException
- If the name coincides with
an actor already in the container.Method Detail |
---|
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class CompositeActor
IllegalActionException
- If any called method throws
IllegalActionException.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class CompositeActor
IllegalActionException
- If no actor is found with
the given name or the found actor is not compatible.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class CompositeActor
IllegalActionException
- Not thrown in this base class.protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOException
_exportMoMLContents
in class CompositeEntity
output
- The output to write to.depth
- The depth in the hierarchy, to determine indenting.
java.io.IOException
- If an I/O error occurs.NamedObj.exportMoML(Writer, int)
protected void _finishedAddEntity(ComponentEntity entity)
_finishedAddEntity
in class CompositeActor
entity
- Actor to contain.private void _checkCompatibility() throws IllegalActionException
IllegalActionException
- If the composite actor to be
cloned is not compatible with this actor.private void _cloneRecursionActor() throws IllegalActionException, java.lang.CloneNotSupportedException
IllegalActionException
- If any called method throws
IllegalActionException, or NameDuplicationException is caught
in this method.
java.lang.CloneNotSupportedException
- If the CompositeActor cannot
be cloned.private int _getTokenConsumptionRate(Receiver receiver) throws IllegalActionException
receiver
- The receiver to get token consumption rate.
IllegalActionException
- If any called method throws
IllegalActionException.private void _searchRecursionActor() throws IllegalActionException
IllegalActionException
- If no actor is found with
the given name.private void _setOutputPortRate() throws IllegalActionException
IllegalActionException
- If any called method throws
IllegalActionException.private void _transferInputs() throws IllegalActionException
IllegalActionException
- If conversion to the type of
the destination port cannot be done.private void _transferOutputs() throws IllegalActionException
IllegalActionException
- If conversion to the type of
the destination port cannot be done.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |