ptolemy.domains.dde.kernel
Class DDEActor

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.actor.AtomicActor
                      extended by ptolemy.actor.TypedAtomicActor
                          extended by ptolemy.domains.dde.kernel.DDEActor
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:
FeedBackDelay

public class DDEActor
extends TypedAtomicActor

An optional base class for DDE actors. DDEActors are intended to execute as autonomous processes that maintain a distributed notion of time. In a DDE model, each actor is controlled by a unique DDEThread. Each DDEThread maintains its actor's local notion of time. Local time information is dependent on the time stamps associated with tokens that are consumed by an actor. More precisely, an actor's local notion of time is equivalent to the maximum time stamp of all tokens that the actor has consumed. Constraints on the consumption of tokens are described in the documentation for DDEThread. Note that consumed tokens may include NullTokens. A NullToken is a subclass of Token that is communicated solely for the purpose of advancing the local notion of time of the actor that consumes the NullToken.

The DDE model of computation supports typed, polymorphic actors and does not require this base class for implementation; this class is purely optional. This class provides convenient syntactic shortcuts for developing actors that operate according to DDE semantics.

Since:
Ptolemy II 0.3
Version:
$Id: DDEActor.java 57040 2010-01-27 20:52:32Z cxh $
Author:
John S. Davis II
See Also:
DDEThread, NullToken, Serialized Form
Accepted Rating:
Yellow (yuhong)
Proposed Rating:
Yellow (davisj)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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
DDEActor()
          Construct a DDEActor with no container and a name that is an empty string.
DDEActor(CompositeEntity container, java.lang.String name)
          Construct a DDEActor with the specified container and name.
DDEActor(Workspace workspace)
          Construct a DDEActor with the specified workspace and a name that is an empty string.
 
Method Summary
(package private)  Token _getNextInput()
          Return a token from the receiver that has the minimum receiver time of all receivers contained by this actor.
 Token getNextToken()
          Return a non-NullToken from the receiver that has the minimum, non-negative receiver time of all receivers contained by this actor.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, 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.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, 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, 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
 
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, preinitialize, removeInitializable, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 

Constructor Detail

DDEActor

public DDEActor()
Construct a DDEActor with no container and a name that is an empty string.


DDEActor

public DDEActor(Workspace workspace)
Construct a DDEActor with the specified workspace and a name that is an empty string.

Parameters:
workspace - The workspace for this DDEActor.

DDEActor

public DDEActor(CompositeEntity container,
                java.lang.String name)
         throws IllegalActionException,
                NameDuplicationException
Construct a DDEActor with the specified container and name. The name must be unique with respect to the container or an exception is thrown.

Parameters:
container - The container of this DDEActor.
name - The name of this DDEActor.
Throws:
IllegalActionException - If the constructor of the superclass throws an IllegalActionException.
NameDuplicationException - If the constructor of the superclass throws a NameDuplicationException .
Method Detail

_getNextInput

Token _getNextInput()
              throws IllegalActionException
Return a token from the receiver that has the minimum receiver time of all receivers contained by this actor. The returned token will have the lowest time stamp of all pending tokens for this actor. If there exists a set of multiple receivers that share a common minimum receiver time, then return the token contained by the highest priority receiver within this set. If this actor contains no receivers then return null.

The primary difference between this method and getNextToken() is that this method returns all types of tokens including NullTokens while getNextToken only returns real tokens.

Returns:
The token with the smallest time stamp of all tokens contained by this actor. If multiple tokens share the smallest time stamp this token will come from the highest priority receiver that has the minimum receiver time. If all receivers have expired then throw a TerminateProcessException.
Throws:
IllegalActionException
See Also:
DDEReceiver, TimeKeeper, DDEThread

getNextToken

public Token getNextToken()
                   throws IllegalActionException
Return a non-NullToken from the receiver that has the minimum, non-negative receiver time of all receivers contained by this actor. If there exists a set of multiple receivers that share a common minimum receiver time, then return the token contained by the highest priority receiver within this set. If this actor contains no receivers then return null. This method may block as it calls several blocking methods.

Returns:
Return a non-NullToken that has the minimum, nonnegative receiver time of all receivers contained by this actor.
Throws:
IllegalActionException - If there is a problem getting the next input.