ptolemy.domains.tm.lib
Class TMCompositeFacade

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.kernel.CompositeEntity
                      extended byptolemy.actor.CompositeActor
                          extended byptolemy.actor.TypedCompositeActor
                              extended byptolemy.domains.tm.lib.TMCompositeFacade
All Implemented Interfaces:
Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TMActor, TypedActor

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,v 1.15 2004/04/13 05:13:05 cxh Exp $
Author:
Jie Liu
See Also:
Serialized Form
Accepted Rating:
Red (liuj)
Proposed Rating:
Red (liuj)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 Parameter executionTime
          The default execution time.
 Parameter priority
          Priority of the background process.
 
Fields inherited from class ptolemy.actor.CompositeActor
_stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
TMCompositeFacade(CompositeEntity container, java.lang.String name)
          Construct an actor with the specified container and name.
 
Method Summary
protected  void _transferInputs()
           
protected  void _transferOutputs()
           
 void attributeChanged(Attribute attribute)
          update local cache of executionTime.
 void fire()
          Fire the actor.
 double getExecutionTime()
          Return the execution time for this iteration.
 boolean postfire()
          This method should be invoked once per iteration, after the last invocation of fire() in that iteration.
 boolean prefire()
          This method should be invoked once per iteration, before the first invocation of fire() in that iteration.
 void preinitialize()
          Create the execution thread.
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList
 
Methods inherited from class ptolemy.actor.CompositeActor
_finishedAddEntity, _setDirector, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, isOpaque, iterate, newInsideReceiver, newReceiver, outputPortList, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _description, _exportMoMLContents, _removeEntity, _removeRelation, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, entityList, entityList, exportLinks, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, numberOfClassDefinitions, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, uniqueName, validateSettables
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _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, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
initialize, iterate, stop, stopFire, terminate, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Field Detail

executionTime

public Parameter executionTime
The default execution time.


priority

public Parameter priority
Priority of the background process.

Constructor Detail

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. No ports.

Method Detail

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 Executable
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 interface: Executable
This method should be invoked once per iteration, before the first invocation of fire() in that iteration. It returns true if the iteration can proceed (the fire() method can be invoked). Thus this method will typically check preconditions for an iteration, if there are any. In an opaque, non-atomic entity, it may move data into an inner subsystem. The execution of this method is bounded.

Specified by:
prefire in interface Executable
Overrides:
prefire in class CompositeActor
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 interface: Executable
Fire the actor. This may be invoked several times between invocations of prefire() and postfire(). Output data may (and normally will) be produced. Typically, the fire() method performs the computation associated with an actor. This method is not required to have bounded execution. However, after endFire() is called, this method should return in bounded time.

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 interface: Executable
This method should be invoked once per iteration, after the last invocation of fire() in that iteration. It may produce output data. It returns true if the execution can proceed into the next iteration, false if the actor does not wish to be fired again. This method typically wraps up an iteration, which may involve updating local state. In an opaque, non-atomic entity, it may also transfer output data. The execution of this method is bounded.

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
Throws:
IllegalActionException

_transferOutputs

protected void _transferOutputs()
                         throws IllegalActionException
Throws:
IllegalActionException

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