ptolemy.actor.lib
Class Source
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
- Direct Known Subclasses:
- AudioReader, Const, DirectoryListing, EventButton, FileReader, HadamardCode, ImageSequence, LineReader, RandomSource, Reader, SecretKey, SequenceSource, SliderSource, TimedSource, Undefined, URLReader, WallClockTime
- public abstract class Source
- extends TypedAtomicActor
Base class for simple data sources. This class provides an output
port and a trigger input port, both exposed as public variables.
The trigger port is a multiport with undeclared type, meaning that
you can supply it with any data type. The trigger port can also be
left unconnected. The purpose of the trigger input is to
(optionally) supply events that cause the actor to fire. For some
domains, such as SDF and CT, this is entirely unnecessary, as the
actor will fire whether inputs are supplied or not. In such
domains, the trigger input will normally be left unconnected. In
this base class, the fire() method reads at most one token from
each channel of the trigger input, if any, and then discards the
token.
Some derived classes may attach additional significance to an input
on the trigger port. For example, they might fix the type and attach
some significance to the value. Note that it is not recommend to
use getWidth() on the port to determine whether the port is connected,
since the width may be greater than zero even if there
is no actual source of data. This can occur, for example, if a trigger port
is connected to the inside of a port of an opaque composite actor, and
there is nothing connected to the outside of that port. It is not
recommended to make the behavior of an actor dependent on a global
property such as whether there is ultimately a source of data.
- Since:
- Ptolemy II 0.3
- Version:
- $Id: Source.java,v 1.36 2004/04/13 18:57:25 cxh Exp $
- Author:
- Edward A. Lee
- See Also:
- 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 |
Source(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
|
Method Summary |
void |
fire()
Read at most one input token from each channel of the trigger
input and discard it. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, 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 |
output
public TypedIOPort output
- The output port. The type of this port is unspecified.
Derived classes may set it.
trigger
public TypedIOPort trigger
- The trigger port. The type of this port is undeclared, meaning
that it will resolve to any data type.
Source
public Source(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the given container and name.
The output and trigger ports are also constructed.
- 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.
fire
public void fire()
throws IllegalActionException
- Read at most one input token from each channel of the trigger
input and discard it. If the trigger input is not connected
or has no actual sources (it might be connected to other
inputs, for example, or to an unconnected input port at
a higher level in the hierarchy) then this method does
nothing. Derived classes should be
sure to call super.fire(), or to consume the trigger input
tokens themselves, so that they aren't left unconsumed.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - Not thrown in this base class.