ptolemy.domains.sr.lib
Class NonStrictDelay

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.actor.AtomicActor
                      extended byptolemy.actor.TypedAtomicActor
                          extended byptolemy.actor.lib.Transformer
                              extended byptolemy.domains.sr.lib.NonStrictDelay
All Implemented Interfaces:
Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor

public class NonStrictDelay
extends Transformer

This actor provides a token delay. It has one input port and one output port, both of which are single ports. A token that is received on the input port is sent on the output port on the next iteration. If more than one token is received on the input port in a given iteration, only the final token is output on the next iteration. If no tokens are received on the input port in a given iteration (regardless of whether the initialValue parameter is set), no token is output on the next iteration.

You can specify the value of the token to be emitted in the first iteration by setting the initialValue parameter. The token is emitted in the first iteration, regardless of whether any tokens are received on the input port. If the parameter is left empty, then no token is emitted in the first iteration.

FIXME: This actor is truly questionable in an SR domain. It uses a special token, AbsentToken, and delays that as well as real tokens. This does not conform with the usual SR behavior. (EAL) Compare this actor to other single token delay actors:

Since:
Ptolemy II 2.0
Version:
$Id: NonStrictDelay.java,v 1.28.2.1 2004/06/20 03:10:45 cxh Exp $
Author:
Paul Whitaker and Elaine Cheong
See Also:
SampleDelay, TimedDelay, Serialized Form
Accepted Rating:
Yellow (cxh)
Proposed Rating:
Yellow (celaine)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
protected  Token _currentToken
           
protected  Token _previousToken
           
 Parameter initialValue
          Initial token value.
 
Fields inherited from class ptolemy.actor.lib.Transformer
input, output
 
Fields inherited from class ptolemy.actor.AtomicActor
_stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
NonStrictDelay(CompositeEntity container, java.lang.String name)
          Construct an actor in the specified container with the specified name.
 
Method Summary
 void fire()
          If the input known and there is a token on the input port, consume the token from the input port, and store it for output on the next iteration.
 void initialize()
          Initialize the state of the actor.
 boolean postfire()
          Update the state of the actor.
 void pruneDependencies()
          Override the base class to declare that the output does not depend on the input in a firing.
 java.util.List typeConstraintList()
          Override the method in the base class so that the type constraint for the initialValue parameter will be set if it contains a value.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, attributeTypeChanged, clone, newPort
 
Methods inherited from class ptolemy.actor.AtomicActor
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, prefire, preinitialize, removeDependency, setContainer, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _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, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
iterate, prefire, preinitialize, stop, stopFire, terminate, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Field Detail

initialValue

public Parameter initialValue
Initial token value. Can be of any type.

See Also:
typeConstraintList()

_previousToken

protected Token _previousToken

_currentToken

protected Token _currentToken
Constructor Detail

NonStrictDelay

public NonStrictDelay(CompositeEntity container,
                      java.lang.String name)
               throws IllegalActionException,
                      NameDuplicationException
Construct an actor in the specified container with the specified name.

Parameters:
container - The container.
name - The name of this actor within the container.
Throws:
IllegalActionException - If the actor cannot be contained by the proposed container.
NameDuplicationException - If the name coincides with an actor already in the container.
Method Detail

fire

public void fire()
          throws IllegalActionException
If the input known and there is a token on the input port, consume the token from the input port, and store it for output on the next iteration. Otherwise, store an AbsentToken for output on the next iteration. If a token was received on the previous iteration, output it to the receivers. Otherwise, notify the receivers that there will never be any token available in the current iteration.

Specified by:
fire in interface Executable
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If there is no director.

initialize

public void initialize()
                throws IllegalActionException
Initialize the state of the actor.

Specified by:
initialize in interface Executable
Overrides:
initialize in class AtomicActor
Throws:
IllegalActionException - If there is no director.

postfire

public boolean postfire()
                 throws IllegalActionException
Update the state of the actor.

Specified by:
postfire in interface Executable
Overrides:
postfire in class AtomicActor
Returns:
True if execution can continue into the next iteration.
Throws:
IllegalActionException - If there is no director.

pruneDependencies

public void pruneDependencies()
Override the base class to declare that the output does not depend on the input in a firing.

Overrides:
pruneDependencies in class AtomicActor
See Also:
TimedDelay, AtomicActor.removeDependency(IOPort, IOPort), FunctionDependencyOfAtomicActor

typeConstraintList

public java.util.List typeConstraintList()
Override the method in the base class so that the type constraint for the initialValue parameter will be set if it contains a value.

Specified by:
typeConstraintList in interface TypedActor
Overrides:
typeConstraintList in class TypedAtomicActor
Returns:
a list of Inequality objects.
See Also:
Inequality