Package ptolemy.domains.sequence.lib
Class BaseMultipleMethodsActor
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.actor.lib.SetVariable
-
- ptolemy.domains.sequence.lib.SequencedSharedMemoryActor
-
- ptolemy.domains.sequence.lib.BaseMultipleMethodsActor
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,ExplicitChangeContext
,MultipleFireMethodsInterface
,Changeable
,ChangeListener
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
SequencedIntegrator
public abstract class BaseMultipleMethodsActor extends SequencedSharedMemoryActor implements MultipleFireMethodsInterface
Base class for sequenced actors with multiple fire methods.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Charles Shelton
- Pt.AcceptedRating:
- Red (cshelton)
- Pt.ProposedRating:
- Red (cshelton)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_defaultFireMethodName
The number for the default fire method.protected java.lang.String
_fireMethodName
The string name of the fire method currently being used.protected java.util.Hashtable<java.lang.String,java.util.List<IOPort>>
_fireMethodNameToInputPortList
The hashtable that maps fire method names to their list of input ports.protected java.util.List<java.lang.String>
_methodList
The list of method names for the actor.-
Fields inherited from class ptolemy.domains.sequence.lib.SequencedSharedMemoryActor
_scope, _sharedName, initialVariableName
-
Fields inherited from class ptolemy.actor.lib.SetVariable
delayed, input, output, variableName
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
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 BaseMultipleMethodsActor(CompositeEntity container, java.lang.String name)
Create a new instance of an ASCETClassActor with the given name and container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addFireMethod(java.lang.String methodName, IOPort outputPort, java.util.List<IOPort> inputPorts)
Add a fire method for this actor with the specified name.java.lang.String
getDefaultFireMethodName()
Return the name of the default fire method for this actor.java.util.List<java.lang.String>
getFireMethodNames()
Return the list of strings that represent the names of all the fire methods the actor has.java.util.List<IOPort>
getMethodInputPortList(java.lang.String methodName)
Return the list of input ports associated with the given method name.IOPort
getMethodOutputPort(java.lang.String methodName)
Return the output port associated with the given method name, if there is one.int
numFireMethods()
Return the number of fire methods the actor has.void
setFireMethod(java.lang.String methodName)
Set the fire method to the method that matches the specified string name.-
Methods inherited from class ptolemy.domains.sequence.lib.SequencedSharedMemoryActor
_getDefaultValue, _setValue, _setValue, checkForAttributes, checkForAttributes, fire, getInitialVariable, getInitialVariableName, getModifiedVariable, getModifiedVariable, getSharedName, getVariable, getVariableName, preinitialize, setName
-
Methods inherited from class ptolemy.actor.lib.SetVariable
_customTypeConstraints, changeExecuted, changeFailed, clone, getContext, getModifiedVariables, postfire
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, 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, requestChange, 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, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName
-
-
-
-
Field Detail
-
_defaultFireMethodName
protected java.lang.String _defaultFireMethodName
The number for the default fire method.
-
_methodList
protected java.util.List<java.lang.String> _methodList
The list of method names for the actor.
-
_fireMethodName
protected java.lang.String _fireMethodName
The string name of the fire method currently being used.
-
_fireMethodNameToInputPortList
protected java.util.Hashtable<java.lang.String,java.util.List<IOPort>> _fireMethodNameToInputPortList
The hashtable that maps fire method names to their list of input ports.
-
-
Constructor Detail
-
BaseMultipleMethodsActor
public BaseMultipleMethodsActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new instance of an ASCETClassActor with the given name and container.- Parameters:
container
- The model in which the new actor will be contained.name
- The name of the new actor- Throws:
IllegalActionException
- If the new actor cannot be created.NameDuplicationException
- If there is already a NamedObj with the same name in the container model.
-
-
Method Detail
-
getDefaultFireMethodName
public java.lang.String getDefaultFireMethodName()
Return the name of the default fire method for this actor.- Specified by:
getDefaultFireMethodName
in interfaceMultipleFireMethodsInterface
- Returns:
- The string name of the default fire method for the actor. If the actor does not have multiple fire methods, return null.
-
getFireMethodNames
public java.util.List<java.lang.String> getFireMethodNames()
Return the list of strings that represent the names of all the fire methods the actor has.- Specified by:
getFireMethodNames
in interfaceMultipleFireMethodsInterface
- Returns:
- The list of fire method names strings.
-
getMethodInputPortList
public java.util.List<IOPort> getMethodInputPortList(java.lang.String methodName)
Return the list of input ports associated with the given method name. If the method has no input ports, return an empty list. If the actor does not have multiple methods, return null.- Specified by:
getMethodInputPortList
in interfaceMultipleFireMethodsInterface
- Parameters:
methodName
- The specified method name.- Returns:
- The list of input ports associated with the method name.
-
getMethodOutputPort
public IOPort getMethodOutputPort(java.lang.String methodName)
Return the output port associated with the given method name, if there is one. If the method does not have any outputs, or the actor does not have multiple fire methods, return null- Specified by:
getMethodOutputPort
in interfaceMultipleFireMethodsInterface
- Parameters:
methodName
- The specified name of the method.- Returns:
- The output port associated with this method, or null is there is none.
-
numFireMethods
public int numFireMethods()
Return the number of fire methods the actor has.- Specified by:
numFireMethods
in interfaceMultipleFireMethodsInterface
- Returns:
- the number of fire methods the actor has, which should be at least one.
-
setFireMethod
public void setFireMethod(java.lang.String methodName) throws IllegalActionException
Set the fire method to the method that matches the specified string name.- Specified by:
setFireMethod
in interfaceMultipleFireMethodsInterface
- Parameters:
methodName
- The name of the method to be used.- Throws:
IllegalActionException
- If the specified fire method cannot be found in the actor.
-
_addFireMethod
protected void _addFireMethod(java.lang.String methodName, IOPort outputPort, java.util.List<IOPort> inputPorts) throws IllegalActionException, NameDuplicationException
Add a fire method for this actor with the specified name. A fire method can optionally be associated with one output port and a list of input ports. No two methods can be associated with the same input port or output port. And no two methods can have the same name.- Parameters:
methodName
- The name of the fire method to be added.outputPort
- The output port associated with this method, or null if there is none.inputPorts
- The list of input ports associated with this method, or null if there are none.- Throws:
IllegalActionException
- If a the method specifies an output port or input ports already associated with another fire method.NameDuplicationException
- If there is already another method with the same name specified for this actor.
-
-