Package ptolemy.component
Class ComponentActor
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Component
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class ComponentActor extends TypedCompositeActor implements Component
A Component is outside compatible with components and inside compatable with actors.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Yang Zhao
- Pt.AcceptedRating:
- red (cxh)
- Pt.ProposedRating:
- yellow (ellen_zh)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description ptolemy.component.ComponentActor.IOMethodPort
input
ptolemy.component.ComponentActor.IOMethodPort
output
-
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
-
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description ComponentActor(CompositeEntity container, java.lang.String name)
Construct an entity with the given name contained by the specified entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addRelation(ComponentRelation relation)
Add a relation to this container.protected TupleToken
_executeInside()
Invoke one iteration and transfer the token to a method call.java.lang.Object
clone(Workspace workspace)
Clone the actor into the specified workspace.void
connectionsChanged(Port port)
Invalidate the schedule and type resolution and create new receivers if the specified port is an opaque output port.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.void
initialize()
Initialize this actor.void
preinitialize()
Load the generated class and search for its fire method.void
run()
Execute the component, which in this base class means doing nothing and returning immediately.void
wrapup()
If this actor is opaque, then invoke the wrapup() method of the local director.-
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _checkTypesFromTo, _destinationTypeConstraints, attributeChanged, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, createReceivers, createSchedule, 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, postfire, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
-
Methods inherited from class ptolemy.kernel.CompositeEntity
_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
-
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 ptolemy.kernel.util.NamedObj
_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
-
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.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
ComponentActor
public ComponentActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an entity with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This entity will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace. This constructor write-synchronizes on the workspace.- Parameters:
container
- The container entity.name
- The name of the entity.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the name coincides with an entity already in the container.
-
-
Method Detail
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the actor into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there). The result is a composite actor with clones of the ports of the original actor, the contained actors, and the contained relations. The ports of the returned actor are not connected to anything. The connections of the relations are duplicated in the new composite, unless they cross levels, in which case an exception is thrown. The local director is cloned, if there is one. The executive director is not cloned. NOTE: This will not work if there are level-crossing transitions.- Overrides:
clone
in classCompositeActor
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- A new CompositeActor.
- Throws:
java.lang.CloneNotSupportedException
- If the actor contains level crossing transitions so that its connections cannot be cloned, or if one of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
connectionsChanged
public void connectionsChanged(Port port)
Invalidate the schedule and type resolution and create new receivers if the specified port is an opaque output port. Also, notify the containers of any ports deeply connected on the inside by calling their connectionsChanged() methods, since their width may have changed.- Overrides:
connectionsChanged
in classCompositeActor
- Parameters:
port
- The port that has connection changes.
-
fire
public void fire() throws IllegalActionException
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 interfaceExecutable
- Overrides:
fire
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's fire() method throws it, or if the actor is not opaque.
-
preinitialize
public void preinitialize() throws IllegalActionException
Load the generated class and search for its fire method.- Specified by:
preinitialize
in interfaceComponent
- Specified by:
preinitialize
in interfaceInitializable
- Overrides:
preinitialize
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's preinitialize() method throws it, or if this actor is not opaque.
-
run
public void run() throws IllegalActionException
Execute the component, which in this base class means doing nothing and returning immediately. This is invoked after preinitialize() and initialize(), and may be invoked repeatedly.- Specified by:
run
in interfaceComponent
- Throws:
IllegalActionException
- If the run cannot be completed (not thrown in this base class).
-
initialize
public void initialize() throws IllegalActionException
Description copied from class:CompositeActor
Initialize this actor. If this actor is opaque, invoke the initialize() method of its local director. Otherwise, throw an exception. This method is read-synchronized on the workspace, so the initialize() method of the director need not be (assuming it is only called from here).- Specified by:
initialize
in interfaceComponent
- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's initialize() method throws it, or if the actor is not opaque.
-
wrapup
public void wrapup() throws IllegalActionException
Description copied from class:CompositeActor
If this actor is opaque, then invoke the wrapup() method of the local director. This method is read-synchronized on the workspace.- Specified by:
wrapup
in interfaceComponent
- Specified by:
wrapup
in interfaceInitializable
- Overrides:
wrapup
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's wrapup() method throws it, or if this actor is not opaque.
-
_executeInside
protected TupleToken _executeInside()
Invoke one iteration and transfer the token to a method call.
-
_addRelation
protected void _addRelation(ComponentRelation relation) throws IllegalActionException, NameDuplicationException
Description copied from class:TypedCompositeActor
Add a relation to this container. This overrides the base class to throw an exception if the proposed relation is not an instance of TypedIORelation. This method should not be used directly. Call the setContainer() method of the relation instead. This method does not set the container of the relation to refer to this container. This method is not synchronized on the workspace, so the caller should be.- Overrides:
_addRelation
in classTypedCompositeActor
- Parameters:
relation
- The TypedIORelation to contain.- Throws:
IllegalActionException
- If the relation has no name, or is not an instance of TypedIORelation.NameDuplicationException
- If the name collides with a name already on the contained relations list.
-
-