public class TransmitPropertyTransformer extends LifeCycleManager implements PropertyTransformer
This actor implements the PropertyTransformer interface, which provides a callback that can be use to modify the transmit properties of a transmission. It register itself and its connected wireless output port with the channel that the wireless output port uses. The channel will call its transformProperties() method for each transmission from the registered output port.
When transformProperties() is called, this actor sets the value of three variables and then performs a complete execution of the contained model. The three variables are senderLocation (an array of doubles), receiverLocation (also an array of doubles), and properties (a record token containing the transmit properties to be modified). After execution of the contained model, the (possibly modified) value of the record properties is taken to be the modified properties. Thus, a contained model would normally read the variable properties, change it, and use a SetVariable actor to set the new value of properties.
This actor expects its output port to be connected directly to the inside of a WirelessIOPort belonging to this actor's container. It looks for this port in the preinitialize() method, and registers with the channel specified by that port. If there is no such port, or no such channel, then preinitialize() throws an exception. Note that since this connectivity is checked only during preinitialize(), this actor does not support dynamically reconnecting its output port during execution of the model.
Red (pjb2e) |
Yellow (eal) |
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
TypedIOPort |
input
Port that receives the data to be transmitted on the output
port.
|
TypedIOPort |
output
Port that sends data to a wireless output.
|
Parameter |
properties
The properties to be transformed.
|
Parameter |
receiverLocation
The location of the receiver.
|
Parameter |
senderLocation
The location of the sender.
|
_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 |
---|
TransmitPropertyTransformer(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_readInputs()
Override the base class to not read any inputs.
|
protected void |
_writeOutputs()
Override the base class to not write any outputs.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
fire()
Read at most one token from the input
port and simply transmit the data to the output port.
|
boolean |
postfire()
Return true, indicating that execution can continue.
|
boolean |
prefire()
Return true, indicating that this actor is always ready to fire.
|
void |
preinitialize()
Register with the channel as a PropertyTransformer
for its connected wireless output port.
|
RecordToken |
transformProperties(RecordToken initialProperties,
WirelessIOPort sender,
WirelessIOPort destination)
Set the senderLocation, receiverLocation, and
properties variables and execute the contained model.
|
void |
wrapup()
Override the base class to unregister this actor with the
channel.
|
_executeInsideModel, _fireInsideModel, _getManagedActor, addChangeListener, executeChangeRequests, isDeferringChangeRequests, removeChangeListener, requestChange, setDeferringChangeRequests
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeChanged, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, connectionsChanged, createReceivers, createSchedule, 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, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
_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
_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
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeDebugListener, removeHierarchyListener, setClassName, 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
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
addInitializable, initialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort input
public TypedIOPort output
public Parameter senderLocation
public Parameter receiverLocation
public Parameter properties
public TransmitPropertyTransformer(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class CompositeActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class CompositeActor
IllegalActionException
- If there is no director, or if
the director's action methods throw it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class CompositeActor
IllegalActionException
- Not thrown in this class,
but declared so the subclasses can throw it.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class CompositeActor
IllegalActionException
- Not thrown in this class,
but declared so the subclasses can throw it.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class CompositeActor
IllegalActionException
- If the output is not
connected directly to a WirelessIOPort, or if the port's
container does not have a container, or if no channel is
found.public RecordToken transformProperties(RecordToken initialProperties, WirelessIOPort sender, WirelessIOPort destination) throws IllegalActionException
transformProperties
in interface PropertyTransformer
initialProperties
- The initial value of the properties.sender
- The sending port.destination
- The receiving port.IllegalActionException
- If executing the model
throws it.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class CompositeActor
IllegalActionException
- If the base class throws it.protected void _readInputs()
_readInputs
in class LifeCycleManager
protected void _writeOutputs()
_writeOutputs
in class LifeCycleManager