ptolemy.domains.tm.lib
Class TMCompositeFacade
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.kernel.CompositeEntity
ptolemy.actor.CompositeActor
ptolemy.actor.TypedCompositeActor
ptolemy.domains.tm.lib.TMCompositeFacade
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, TMActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class TMCompositeFacade
- extends TypedCompositeActor
- implements TMActor
A facade for a composite actor that creates and executes its internal
model a background process
FIXME: EXPERIMENTAL.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: TMCompositeFacade.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Jie Liu
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Method Summary |
protected void |
_transferInputs()
Transfer inputs from the ports. |
protected void |
_transferOutputs()
Transfer outputs from the ports. |
void |
attributeChanged(Attribute attribute)
update local cache of executionTime. |
void |
fire()
If this actor is opaque, transfer any data from the input ports
of this composite to the ports connected on the inside, and then
invoke the fire() method of its local director. |
double |
getExecutionTime()
Return the execution time for this iteration. |
boolean |
postfire()
If this actor is opaque, invoke the postfire() method of its
local director and transfer output data. |
boolean |
prefire()
If this actor is opaque, invoke the prefire() method of the local
director. |
void |
preinitialize()
Create the execution thread. |
Methods inherited from class ptolemy.actor.CompositeActor |
_actorFiring, _actorFiring, _finishedAddEntity, _getPublishedPort, _setDirector, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, recordFiring, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, wrapup |
Methods inherited from class ptolemy.kernel.CompositeEntity |
_adjustDeferrals, _deepOpaqueEntityList, _description, _exportMoMLContents, _recordDecoratedAttributes, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName |
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.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, 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, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
executionTime
public Parameter executionTime
- The default execution time.
priority
public Parameter priority
- Priority of the background process.
_idle
private boolean _idle
_executionTime
private double _executionTime
_directorThread
private PtolemyThread _directorThread
_priority
private int _priority
TMCompositeFacade
public TMCompositeFacade(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the specified container and name.
There is one parameter which is the full class name of
a Ptolemy actor. This actor has no ports.
- Parameters:
container
- The container.name
- The name.
- Throws:
IllegalActionException
- If the actor cannot be contained
by the proposed container.
NameDuplicationException
- If the name coincides with
an actor already in the container.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- update local cache of executionTime.
- Overrides:
attributeChanged
in class NamedObj
- Parameters:
attribute
- The attribute that changed.
- Throws:
IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).
preinitialize
public void preinitialize()
throws IllegalActionException
- Create the execution thread.
- Specified by:
preinitialize
in interface Initializable
- Overrides:
preinitialize
in class CompositeActor
- Throws:
IllegalActionException
- If there is no director, or if
the director's preinitialize() method throws it, or if this actor
is not opaque.
prefire
public boolean prefire()
throws IllegalActionException
- Description copied from class:
CompositeActor
- If this actor is opaque, invoke the prefire() method of the local
director. This method returns true if the actor is ready to fire
(determined by the prefire() method of the director).
It is read-synchronized on the workspace.
- Specified by:
prefire
in interface Executable
- Overrides:
prefire
in class CompositeActor
- Returns:
- True if the iteration can proceed.
- Throws:
IllegalActionException
- If there is no director,
or if the director's prefire() method throws it, or if this actor
is not opaque.
fire
public void fire()
throws IllegalActionException
- Description copied from class:
CompositeActor
- If this actor is opaque, transfer any data from the input ports
of this composite to the ports connected on the inside, and then
invoke the fire() method of its local director.
The transfer is accomplished by calling the transferInputs() method
of the local director (the exact behavior of which depends on the
domain). If the actor is not opaque, throw an exception.
This method is read-synchronized on the workspace, so the
fire() method of the director need not be (assuming it is only
called from here). After the fire() method of the director returns,
send any output data created by calling the local director's
transferOutputs method.
- Specified by:
fire
in interface Executable
- Overrides:
fire
in class CompositeActor
- Throws:
IllegalActionException
- If there is no director, or if
the director's fire() method throws it, or if the actor is not
opaque.
postfire
public boolean postfire()
throws IllegalActionException
- Description copied from class:
CompositeActor
- If this actor is opaque, invoke the postfire() method of its
local director and transfer output data.
Specifically, transfer any data from the output ports of this composite
to the ports connected on the outside. The transfer is accomplished
by calling the transferOutputs() method of the executive director.
If there is no executive director, then no transfer occurs.
This method is read-synchronized on the workspace.
- Specified by:
postfire
in interface Executable
- Overrides:
postfire
in class CompositeActor
- Returns:
- True if the execution can continue into the next iteration.
- Throws:
IllegalActionException
- If there is no director,
or if the director's postfire() method throws it, or if this
actor is not opaque.
_transferInputs
protected void _transferInputs()
throws IllegalActionException
- Transfer inputs from the ports.
- Throws:
IllegalActionException
- If the director throws it
while transferring inputs.
_transferOutputs
protected void _transferOutputs()
throws IllegalActionException
- Transfer outputs from the ports.
- Throws:
IllegalActionException
- If the director throws it
while transferring outputs
getExecutionTime
public double getExecutionTime()
- Description copied from interface:
TMActor
- Return the execution time for this iteration. This method
will be called by the TMDirector after the prefire() method
is called. The reason for this method is to allow the actor
to determine/estimate its execution time on a per iteration
basis.
- Specified by:
getExecutionTime
in interface TMActor
- Returns:
- The execution time for this iteration.