public abstract class Receiver extends ProgramCodeGeneratorAdapter
Red (jiazou) |
Red (jiazou) |
ProgramCodeGeneratorAdapter.Channel
NamedObj.ContainedObjectsIterator
_component, _defaultBlocks, _eol, _templateParser
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
Receiver(Receiver receiver)
Construct the Receiver adapter.
|
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
_generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source)
Generate the type conversion statement for the particular offset of
the two given channels.
|
protected Director |
_getDirectorForReceiver()
Each receiver is associated with a director, return that director.
|
protected java.lang.String |
_removeSink(java.lang.String token)
Given a String that is an assignment operation, return the
right hand side (the source).
|
abstract java.lang.String |
generateGetCode(java.lang.String offset)
Generate code for getting tokens from the receiver.
|
abstract java.lang.String |
generateHasTokenCode(java.lang.String offset)
Generate code to check if the receiver has a token.
|
java.lang.String |
generateInitializeCode()
Generate the initialize code.
|
abstract java.lang.String |
generatePutCode(IOPort sourcePort,
java.lang.String offset,
java.lang.String token)
Generate code for putting tokens to the receiver.
|
Receiver |
getComponent()
Get the corresponding component.
|
java.lang.String |
getName()
Return the name of this receiver.
|
_generateBlockByName, getAdapter, getCodeGenerator, getTemplateParser, processCode, setCodeGenerator, setTemplateParser, toString
createDecoratorAttributes, generateName
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateExistence, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
public Receiver(Receiver receiver) throws IllegalActionException
receiver
- The ptolemy.actor.receiver that corresponds
with this adapterIllegalActionException
- If thrown by the super class.public abstract java.lang.String generateGetCode(java.lang.String offset) throws IllegalActionException
offset
- The offset in the array representation of the port.IllegalActionException
- If the receiver adapter is
not found or it encounters an error while generating the
get code.public abstract java.lang.String generateHasTokenCode(java.lang.String offset) throws IllegalActionException
offset
- The offset in the array representation of the port.IllegalActionException
- If an error occurs when
getting the receiver adapters or generating their initialize
code.public java.lang.String generateInitializeCode() throws IllegalActionException
IllegalActionException
- If thrown while appending to the
the block or processing the macros.public abstract java.lang.String generatePutCode(IOPort sourcePort, java.lang.String offset, java.lang.String token) throws IllegalActionException
sourcePort
- The port for which to generate the send code.offset
- The offset in the array representation of the port.token
- The token to be sent.IllegalActionException
- If the receiver adapter is
not found or it encounters an error while generating the send
code.public Receiver getComponent()
getComponent
in class ProgramCodeGeneratorAdapter
public java.lang.String getName()
getName
in interface Nameable
getName
in class NamedObj
NamedObj.setName(String)
protected abstract java.lang.String _generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source) throws IllegalActionException
source
- The given source channel.IllegalActionException
- If there is a problem getting the
adapters for the ports or if the conversion cannot be handled.protected java.lang.String _removeSink(java.lang.String token) throws IllegalActionException
The token should be in the form of "sinkRef = $convert(sourceRef)".
token
- A string that contains the assignment.IllegalActionException
- If the token does contain a "=".protected Director _getDirectorForReceiver() throws IllegalActionException
IllegalActionException
- FIXME: this is not exactly correct.