ptolemy.domains.de.lib
Class SingleEvent

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.domains.de.lib.SingleEvent
All Implemented Interfaces:
ptolemy.actor.Actor, ptolemy.kernel.util.Changeable, java.lang.Cloneable, ptolemy.kernel.util.Debuggable, ptolemy.kernel.util.DebugListener, ptolemy.kernel.util.Derivable, ptolemy.actor.Executable, ptolemy.kernel.util.Instantiable, ptolemy.kernel.util.ModelErrorHandler, ptolemy.kernel.util.MoMLExportable, ptolemy.kernel.util.Nameable, java.io.Serializable, ptolemy.actor.TypedActor

public class SingleEvent
extends ptolemy.actor.TypedAtomicActor

This actor produces an event with the specified value at the specified time. In its initialize() method, it queues an event, requesting that it be fired at the specified time. If the time parameter changes before that time is reached, then the event is effectively canceled. No event will be produced.

Since:
Ptolemy II 1.0
Version:
$Id: SingleEvent.java,v 1.16 2004/04/13 03:29:44 cxh Exp $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (liuj)
Proposed Rating:
Yellow (eal)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.Entity
ptolemy.kernel.Entity.ContainedObjectsIterator
 
Field Summary
 ptolemy.actor.TypedIOPort output
          The output port.
 ptolemy.data.expr.Parameter time
          The time at which to produce the output.
 ptolemy.data.expr.Parameter value
          The value produced at the 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
SingleEvent(ptolemy.kernel.CompositeEntity container, java.lang.String name)
          Construct an actor with the specified container and name.
 
Method Summary
 void attributeTypeChanged(ptolemy.kernel.util.Attribute attribute)
          Allow type changes on the value parameter, and notify the director that resolved types are invalid.
 java.lang.Object clone(ptolemy.kernel.util.Workspace workspace)
          Clone the actor into the specified workspace.
 void fire()
          If the current time matches the value of the time parameter, then produce an output token with value given by the value parameter.
 void initialize()
          Request firing at the time given by the time parameter.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, clone, newPort, typeConstraintList
 
Methods inherited from class ptolemy.actor.AtomicActor
_createReceivers, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, 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, postfire, 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

output

public ptolemy.actor.TypedIOPort output
The output port. The type of this port is linked to the type of the value parameter.


time

public ptolemy.data.expr.Parameter time
The time at which to produce the output. This has type double, with default value 0.0. If the value is negative, then no output will be produced.


value

public ptolemy.data.expr.Parameter value
The value produced at the output. This can have any type, and it defaults to a boolean token with value true.

Constructor Detail

SingleEvent

public SingleEvent(ptolemy.kernel.CompositeEntity container,
                   java.lang.String name)
            throws ptolemy.kernel.util.NameDuplicationException,
                   ptolemy.kernel.util.IllegalActionException
Construct an actor with the specified container and name.

Parameters:
container - The container.
name - The name of this actor.
Throws:
ptolemy.kernel.util.IllegalActionException - If the entity cannot be contained by the proposed container.
ptolemy.kernel.util.NameDuplicationException - If the container already has an actor with this name.
Method Detail

attributeTypeChanged

public void attributeTypeChanged(ptolemy.kernel.util.Attribute attribute)
                          throws ptolemy.kernel.util.IllegalActionException
Allow type changes on the value parameter, and notify the director that resolved types are invalid.

Parameters:
attribute - The attribute whose type changed.
Throws:
ptolemy.kernel.util.IllegalActionException - If the parent class throws it.

clone

public java.lang.Object clone(ptolemy.kernel.util.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.

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.

initialize

public void initialize()
                throws ptolemy.kernel.util.IllegalActionException
Request firing at the time given by the time parameter. If the time is negative, then do nothing.

Throws:
ptolemy.kernel.util.IllegalActionException - If there is no director.

fire

public void fire()
          throws ptolemy.kernel.util.IllegalActionException
If the current time matches the value of the time parameter, then produce an output token with value given by the value parameter.

Throws:
ptolemy.kernel.util.IllegalActionException