ptolemy.domains.continuous.lib
Class EventSource

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.continuous.lib.EventSource
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

Deprecated. Use with period set to Infinity

public class EventSource
extends TypedAtomicActor

This actor outputs a set of events at a discrete set of time points. It can be used to generate impulses in Continuous models. Events are produced at superdense time index 1 or greater in order to ensure that the output is piecewise continuous.

This actor only generates predictable events and that is why it does not implement the ContinuousStepSizeControlActor interface. This actor requests a refiring in its initialize() method to produce events. During its postfire() method, it requests further firings to produce more events if necessary.

Since:
Ptolemy II 6.0
Version:
$Id: EventSource.java 57046 2010-01-27 23:35:53Z cxh $
Author:
Haiyang Zheng
See Also:
Serialized Form
Accepted Rating:
Yellow (hyzheng)
Proposed Rating:
Yellow (hyzheng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
private  Time _cycleStartTime
          Deprecated. The most recent cycle start time.
private  int _nextOutputIndex
          Deprecated. The index of when the output should be emitted.
private  Time _nextOutputTime
          Deprecated. The next time point when the output should be emitted.
private  double[] _offsets
          Deprecated. Cache of offsets array value.
private  int _phase
          Deprecated. The phase of the next output.
private  int _readyToFire
          Deprecated. The flag indicating whether the time is right to produce output.
private static int _TIME_NOT_RIGHT
          Deprecated.  
private static int _TIME_RIGHT
          Deprecated.  
private static int _TIME_RIGHT_INDEX_EARLY
          Deprecated.  
 Parameter offsets
          Deprecated. The offsets at which the specified values will be produced.
 TypedIOPort output
          Deprecated. The output port.
 Parameter period
          Deprecated. The period of the output events.
 Parameter values
          Deprecated. The values that will be produced at the specified offsets.
 
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
EventSource(CompositeEntity container, java.lang.String name)
          Deprecated. Construct an actor in the specified container with the specified name.
 
Method Summary
 void attributeChanged(Attribute attribute)
          Deprecated. If the argument is the offsets parameter, check that the array is nondecreasing and has the right dimension; if the argument is period, check that it is positive.
 java.lang.Object clone(Workspace workspace)
          Deprecated. Clone the actor into the specified workspace.
 void fire()
          Deprecated. Emit the discrete event that happens at the current time.
 void initialize()
          Deprecated. Schedule the first firing and initialize local variables.
 boolean postfire()
          Deprecated. Update the state of the actor and schedule the next firing, if the director is in the discrete phase.
 boolean prefire()
          Deprecated. Return true if this actor is scheduled to fire at the current time.
 
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, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, 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, 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
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, 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
 

Field Detail

output

public TypedIOPort output
Deprecated. 
The output port. The type of this port is determined by from the values parameter.


offsets

public Parameter offsets
Deprecated. 
The offsets at which the specified values will be produced. This parameter must contain an array of doubles, and it defaults to {0.0, 1.0}.


period

public Parameter period
Deprecated. 
The period of the output events. This parameter must contain a DoubleToken, and defaults to 2.0.


values

public Parameter values
Deprecated. 
The values that will be produced at the specified offsets. This parameter must contain an ArrayToken, and defaults to {1, 0}.


_cycleStartTime

private transient Time _cycleStartTime
Deprecated. 
The most recent cycle start time.


_offsets

private transient double[] _offsets
Deprecated. 
Cache of offsets array value.


_phase

private transient int _phase
Deprecated. 
The phase of the next output.


_nextOutputIndex

private transient int _nextOutputIndex
Deprecated. 
The index of when the output should be emitted.


_nextOutputTime

private transient Time _nextOutputTime
Deprecated. 
The next time point when the output should be emitted.


_readyToFire

private transient int _readyToFire
Deprecated. 
The flag indicating whether the time is right to produce output.


_TIME_RIGHT

private static final int _TIME_RIGHT
Deprecated. 
See Also:
Constant Field Values

_TIME_RIGHT_INDEX_EARLY

private static final int _TIME_RIGHT_INDEX_EARLY
Deprecated. 
See Also:
Constant Field Values

_TIME_NOT_RIGHT

private static final int _TIME_NOT_RIGHT
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

EventSource

public EventSource(CompositeEntity container,
                   java.lang.String name)
            throws IllegalActionException,
                   NameDuplicationException
Deprecated. 
Construct an actor in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.

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

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
Deprecated. 
If the argument is the offsets parameter, check that the array is nondecreasing and has the right dimension; if the argument is period, check that it is positive. Other sanity checks with period and values are done in the fire() method.

Overrides:
attributeChanged in class NamedObj
Parameters:
attribute - The attribute that changed.
Throws:
IllegalActionException - If the offsets array is not nondecreasing and nonnegative, or it is not a row vector.

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Deprecated. 
Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer to the parameters of the new actor.

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 contains an attribute that cannot be cloned.
See Also:
NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)

fire

public void fire()
          throws IllegalActionException
Deprecated. 
Emit the discrete event that happens at the current time. If there is no such events, do nothing.

Specified by:
fire in interface Executable
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If the event cannot be sent.

initialize

public void initialize()
                throws IllegalActionException
Deprecated. 
Schedule the first firing and initialize local variables.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class AtomicActor
Throws:
IllegalActionException - If the parent class throws it, or if the values parameter is not a row vector, or if the fireAt() method of the director throws it, or if the director does not agree to fire the actor at the specified time.

postfire

public boolean postfire()
                 throws IllegalActionException
Deprecated. 
Update the state of the actor and schedule the next firing, if the director is in the discrete phase.

Specified by:
postfire in interface Executable
Overrides:
postfire in class AtomicActor
Returns:
True if execution can continue into the next iteration.
Throws:
IllegalActionException - If the director throws it when scheduling the next firing, or if the length of the values and offsets parameters don't match, or if the director does not agree to fire the actor at the specified time.

prefire

public boolean prefire()
                throws IllegalActionException
Deprecated. 
Return true if this actor is scheduled to fire at the current time.

Specified by:
prefire in interface Executable
Overrides:
prefire in class AtomicActor
Returns:
True if this actor is scheduled to fire at the current time.
Throws:
IllegalActionException - If thrown by the super class.