ptolemy.caltrop.actors
Class AbstractCalInterpreter
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.caltrop.actors.AbstractCalInterpreter
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- CalInterpreter
public abstract class AbstractCalInterpreter
- extends TypedAtomicActor
This class is the base class for actors that interpret CAL source
inside the Ptolemy II framework. It configures itself according to an
Actor data structure (setting
up ports, parameters, types etc.) and then proceeds to execute as the
actor by interpreting the actions using the DataflowActorInterpreter infrastructure.
The actor interpreter is configured by a context that injects the
appropriate Token-based value system into the evaluation of
the actions. This is implemented in the class PtolemyPlatform.
For further documentation on CAL, see the
Language Report.
- Since:
- Ptolemy II 4.1
- Version:
- $Id: AbstractCalInterpreter.java,v 1.22 2007/12/07 06:32:04 cxh Exp $
- Author:
- Jörn W. Janneck , Christopher Chang, Steve Neuendorffer
- See Also:
DataflowActorInterpreter,
Context,
PtolemyPlatform,
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 |
_attachActorIcon(java.lang.String name)
Attach the actor icon. |
protected static Type |
_getPtolemyType(caltrop.interpreter.ast.TypeExpr typeExpr)
Get the Ptolemy type that corresponds to the given type expression. |
protected void |
_setupActor(caltrop.interpreter.ast.Actor actor)
Initialize this ptolemy actor using declarations in the given
CAL actor. |
void |
fire()
Fire the actor. |
void |
initialize()
Initialize the actor, clearing its input channels. |
boolean |
postfire()
Commit the last state changes. |
boolean |
prefire()
Prefire the actor. |
void |
preinitialize()
Populate the initial actor environment. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, _createReceivers, addActorFiringListener, addInitializable, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, 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, setName |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
| 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, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
AbstractCalInterpreter
public AbstractCalInterpreter(Workspace workspace)
- Construct an actor in the given workspace.
Increment the version number of the workspace.
- Parameters:
workspace - The workspace that will list the actor.
AbstractCalInterpreter
public AbstractCalInterpreter(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the given container and name.
- Parameters:
container - The container.name - The name of this actor.
- Throws:
IllegalActionException - If the actor cannot be contained
by the proposed container.
NameDuplicationException - If the container already has an
actor with this name.
preinitialize
public void preinitialize()
throws IllegalActionException
- Populate the initial actor environment. This is done by binding
the parameters to the user-supplied values and then evaluating
the definitions of state variables and creating the
corresponding bindings.
- Specified by:
preinitialize in interface Initializable- Overrides:
preinitialize in class AtomicActor
- Throws:
IllegalActionException - If an error occurred during the
retrieval of parameter values or the evaluation of actor state
variable values.
initialize
public void initialize()
throws IllegalActionException
- Initialize the actor, clearing its input channels.
- Specified by:
initialize in interface Initializable- Overrides:
initialize in class AtomicActor
- Throws:
IllegalActionException - If the superclass throws it.
prefire
public boolean prefire()
throws IllegalActionException
- Prefire the actor.
- Specified by:
prefire in interface Executable- Overrides:
prefire in class AtomicActor
- Returns:
- true If the actor can be fired.
- Throws:
IllegalActionException - If thrown by the parent or by the
prefire() meethod of the domain-dependent interpreter.
fire
public void fire()
throws IllegalActionException
- Fire the actor.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - If thrown by the parent or by the
fire() meethod of the domain-dependent interpreter.
postfire
public boolean postfire()
throws IllegalActionException
- Commit the last state changes.
- Specified by:
postfire in interface Executable- Overrides:
postfire in class AtomicActor
- Returns:
- Returns whatever super.postfire() returns.
- Throws:
IllegalActionException - If the superclass throws it.
_setupActor
protected void _setupActor(caltrop.interpreter.ast.Actor actor)
throws java.lang.Exception
- Initialize this ptolemy actor using declarations in the given
CAL actor.
- Parameters:
actor - The CAL actor to be used
- Throws:
java.lang.Exception - If there is a problem initializing the actor.
_attachActorIcon
protected void _attachActorIcon(java.lang.String name)
- Attach the actor icon.
- Parameters:
name - The name of the actor.
_getPtolemyType
protected static Type _getPtolemyType(caltrop.interpreter.ast.TypeExpr typeExpr)
- Get the Ptolemy type that corresponds to the given type expression.
- Parameters:
typeExpr - The type expression, one of "UINT8", "UINT9",
"INT19" or "positive".
- Returns:
- the corresponding type, which currently is always
ptolemy.data.type.BaseType.int.