ptolemy.domains.de.lib
Class Timer
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.de.kernel.DEActor
ptolemy.domains.de.lib.DETransformer
ptolemy.domains.de.lib.Timer
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, SequenceActor, java.io.Serializable, TimedActor, TypedActor
- public class Timer
- extends DETransformer
Given an input time value, this actor produces an output event at
the time of the input plus the value of the input. That is, it sets
a timer, and when the timer goes off, it produces an output.
The output value is given by the value parameter.
Note that the actor queues output events on the event queue
immediately, but with a future time stamp, so that even if the
actor no longer exists after the time delay elapses, the
destination actor will still see the token. If there is no
input token, then no output token is produced.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: Timer.java,v 1.18.2.1 2004/06/20 03:10:44 cxh Exp $
- Author:
- Jie Liu and Edward A. Lee
- See Also:
TimedDelay,
Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
Timer(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name. |
|
Method Summary |
void |
attributeTypeChanged(Attribute attribute)
Allow type changes on the value parameter, and notify
the director that resolved types are invalid. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Read one token from the input and save it so that the
postfire method can produce an output. |
boolean |
postfire()
If the token read in the most recent fire() invocation was
nonnegative, then produce an output with a time stamp in
the future. |
void |
pruneDependencies()
Override the base class to declare that the output
does not depend on the input in a firing. |
| Methods inherited from class ptolemy.domains.de.kernel.DEActor |
newPort |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, prefire, preinitialize, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| 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.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 |
value
public Parameter value
- The value produced at the output. This can have any type,
and it defaults to a boolean token with value true.
Timer
public Timer(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the specified container and name.
- Parameters:
container - The container.name - The name of this actor.
- Throws:
IllegalActionException - If the entity cannot be contained
by the proposed container.
NameDuplicationException - If the container already has an
actor with this name.
attributeTypeChanged
public void attributeTypeChanged(Attribute attribute)
throws IllegalActionException
- Allow type changes on the value parameter, and notify
the director that resolved types are invalid.
- Overrides:
attributeTypeChanged in class TypedAtomicActor
- Parameters:
attribute - The attribute whose type changed.
- Throws:
IllegalActionException - If the parent class throws it.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the actor into the specified workspace. This calls the
base class and then links the type of the value parameter
to the output.
- Overrides:
clone in class AtomicActor
- Parameters:
workspace - The workspace for the new object.
- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException - If a derived class has
has an attribute that cannot be cloned.
fire
public void fire()
throws IllegalActionException
- Read one token from the input and save it so that the
postfire method can produce an output.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - If there is no director.
postfire
public boolean postfire()
throws IllegalActionException
- If the token read in the most recent fire() invocation was
nonnegative, then produce an output with a time stamp in
the future. The time delay is equal to the value of the
input. If there was no input token, or if its value is
negative, then no output is produced.
- 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