public class PtalonActor extends TypedCompositeActor implements Configurable
A TypedCompositeActor is an aggregation of typed actors. A PtalonActor is a TypedCompositeActor whose aggregation is specified by a Ptalon program in an external file. This file is loaded during initialization, and is specified in a FileParameter called ptalonCodeLocation.
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
FileParameter |
ptalonCodeLocation
The location of the Ptalon code.
|
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
PtalonActor(CompositeEntity container,
java.lang.String name)
Construct a PtalonActor with a name and a container.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addAttribute(Attribute attribute)
Add the attribute, and if the attribute is a PtalonParameter,
add it to a list of Ptalon parameters.
|
protected PtalonEvaluator |
_createPtalonEvaluator(PtalonActor actor) |
protected PtalonPopulator |
_createPtalonPopulator() |
protected PtalonRecognizer |
_createPtalonRecognizer(PtalonLexer lexer)
Create Ptalon parser.
|
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description of the contents of this object, which
in this class is the configuration information.
|
protected void |
_initializePtalonActor()
Initialize this PtalonActor.
|
protected void |
_initializePtalonCodeLocation()
This helper method is used to begin the Ptalon compiler if the
ptalonCodeLocation attribute has been updated.
|
protected void |
_removeContents() |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
void |
configure(java.net.URL base,
java.lang.String source,
java.lang.String text)
Read the saved XML for this PtalonActor.
|
java.lang.String |
getConfigureSource()
Return the input source that was specified the last time the
configure() method was called.
|
java.lang.String |
getConfigureText()
Override the default behavior to always return null.
|
java.lang.String |
getMappedName(java.lang.String ptalonName)
Get the stored unique name for a symbol in the PtalonActor.
|
int |
getNestedDepth()
Return the depth of this PtalonActor declaration with respect
to its creator.
|
PtalonParameter |
getPtalonParameter(java.lang.String name)
Find the parameter in the Ptalon code with the specified name,
and return the Ptolemy parameter (java) that was created.
|
void |
setNestedDepth(int depth)
Set the depth of this PtalonActor declaration with respect to
its creator.
|
java.lang.String |
uniqueName(java.lang.String prefix)
Return a name that is guaranteed to not be the name of any
contained attribute, port, class, entity, or relation.
|
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, preinitialize, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort, wrapup
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _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
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public FileParameter ptalonCodeLocation
public PtalonActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor.IllegalActionException
- If the container is incompatible
with this actor.NameDuplicationException
- If the name coincides with
an actor already in the container.public void attributeChanged(Attribute attribute) throws IllegalActionException
We choose to implement this in attributeChanged() instead if preinitialize() because we want changes to be reflected immediately, since preinitialize() is only processed after the model starts to run.
attributeChanged
in class TypedCompositeActor
attribute
- The attribute that changed.IllegalActionException
- If the change is not
acceptable to this container (not thrown in this base class).public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.Exception
configure
in interface Configurable
base
- The base relative to which references within the input
are found, or null if this is not known, or there is none.source
- The input source, which specifies a URL, or null
if none.text
- Configuration information given as text, or null if
none.java.lang.Exception
- If something goes wrong.public java.lang.String getConfigureSource()
getConfigureSource
in interface Configurable
public java.lang.String getConfigureText()
getConfigureText
in interface Configurable
public java.lang.String getMappedName(java.lang.String ptalonName) throws PtalonRuntimeException
ptalonName
- The symbol.PtalonRuntimeException
- If no such symbol exists.public int getNestedDepth()
setNestedDepth(int)
public PtalonParameter getPtalonParameter(java.lang.String name) throws PtalonRuntimeException
name
- The name of the parameter in the Ptalon code,
which may be a prefix of the actual parameter's name.PtalonRuntimeException
- If no such PtalonParameter
exists.public void setNestedDepth(int depth)
depth
- The of this actor declaration with respect to its
creator.getNestedDepth()
public java.lang.String uniqueName(java.lang.String prefix)
uniqueName
in class CompositeEntity
prefix
- A prefix for the name.protected void _addAttribute(Attribute attribute) throws NameDuplicationException, IllegalActionException
_addAttribute
in class NamedObj
attribute
- The attribute to be added.NameDuplicationException
- If the superclass throws it.IllegalActionException
- If the superclass throws it.protected PtalonEvaluator _createPtalonEvaluator(PtalonActor actor)
protected PtalonPopulator _createPtalonPopulator()
protected PtalonRecognizer _createPtalonRecognizer(PtalonLexer lexer)
PtalonRecognizer
instance with the given lexer. Subclasses may override
this function to return a customized parser.lexer
- The lexer.protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOException
_exportMoMLContents
in class CompositeEntity
output
- The output stream for writing.depth
- The depth in the hierarchy, to determine indenting.java.io.IOException
- If an I/O error occurs.NamedObj.exportMoML(Writer, int)
protected void _initializePtalonActor()
protected void _initializePtalonCodeLocation() throws IllegalActionException
IllegalActionException
- If any exception is thrown.protected void _removeContents()