public class Pulse extends SequenceSource
Eventually, this actor will support various kinds of interpolation. For now, it outputs a zero (of the same type as the values) whenever the iteration count does not match an index in indexes.
The default for the values parameter is an integer vector of form {1, 0}. The default indexes array is {0, 1}. Thus, the default output sequence will be 1, 0, 0, ...
However, the Pulse actor has a repeat parameter. When set to true, the defined sequence is repeated indefinitely. Otherwise, the default sequence of zero values result.
The type of the output can be any token type. This type is inferred from the element type of the values parameter.
The Ptolemy Expression language has several constructs that are useful for creating arrays for use as values or indexes:
[0:1:100].toArray()
repeat(100, {1}(0))
NOTE: A reset input for this actor would be useful. This would reset the iterations count, to cause the pulse to emerge again.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
indexes
The indexes at which the specified values will be produced.
|
Parameter |
repeat
The flag that indicates whether the pulse sequence needs to be
repeated.
|
Parameter |
values
The values that will be produced at the specified indexes.
|
_firingCountLimit, firingCountLimit
_triggered, output, trigger
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
Pulse(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeChanged(Attribute attribute)
If the attribute being changed is indexes, then check
that it is increasing and nonnegative.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
fire()
Output a value if the count of iterations matches one of the entries
in the indexes array.
|
void |
initialize()
Set the iteration count to zero.
|
boolean |
postfire()
Update the iteration counters until they exceed the values
in the indexes array.
|
boolean |
prefire()
Start an iteration.
|
_customTypeConstraints
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, 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
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public Parameter indexes
public Parameter repeat
public Parameter values
public Pulse(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class LimitedFiringSource
attribute
- The attribute that changed.IllegalActionException
- If the indexes vector is not
increasing and nonnegative, or the indexes is not a row vector.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class Source
IllegalActionException
- If the values and indexes parameters
do not have the same length, or if there is no director.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class LimitedFiringSource
IllegalActionException
- If the parent class throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class LimitedFiringSource
IllegalActionException
- If the expression of indexes
is not valid.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class Source
IllegalActionException
- If the base class throws it.