ptolemy.actor
Class TypedAtomicActor
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- AbstractCalInterpreter, AbstractPlaceableActor, AddSubtract, ApplyFilterOverArray, ApplyFunction, ApplyFunctionOverSequence, ArrayContains, ArrayLevelCrossing, ArrayPeakSearch, ArrayPeakSearch, ArrayRemoveElement, ArrowKeySensor, AtomicActorMatcher, AtomicWirelessChannel, AudioWriteBuffer, Backtrack, Barrier, Barrier, BinarySwitch, BooleanMultiplexor, BooleanSelect, BooleanSelect, BooleanSwitch, BooleanSwitch, Buffer, BusAssembler, BusDisassembler, CartesianToComplex, CartesianToPolar, ClassWrapper, ClipPlayer, CollisionDetector, ColorFinder, Comparator, ComplexToCartesian, ComplexToPolar, ComputeHistogram, ComputeHistogram, ContinuousIntegrator, Counter, Counter, Course, CryptographyActor, CSPActor, CTBaseIntegrator, DatagramReader, DatagramWriter, DDEActor, DDESink, DDFBooleanSelect, DDFSelect, DEActor, Default, DelayStart, DotProduct, DoubleFork, EmbeddedCActor.EmbeddedActor, EventSource, EventSource, Exec, Expression, Expression, GenericJNIActor, GetProperties, GRActor, InstantaneousDialogGenerator, IntArrayToString, InteractiveShell, JAIPolarToComplex, Joystick, KeyStoreActor, LEDMatrix, LevelCrossingDetector, LevelCrossingDetector, LevinsonDurbin, LinkVisualizer, LiveSoundActor, Locator, MapWorker, MathFunction, Maximum, Merge, MicaLeds, Minimum, MobileFunction, ModelGenerator, ModelReference, MultiplyDivide, NodeRandomizer, NonStrictThreeBitAdder, Or, OrderedMerge, OrderedMerge, PlaySound, PlotterBase, PolarToCartesian, PolarToComplex, PSNR, Publisher, PythonScript, RecordAssembler, RecordDisassembler, RecordUpdater, ReduceWorker, ResourcePool, SDFTransformer, Sequence, Sequence, SequentialClock, SequentialClock, SerialComm, SetProperties, SetVariable, SignatureActor, SingleEvent, Sink, SoundActor, Source, StringCompare, StringIndexOf, StringMatches, StringReplace, StringToIntArray, StringToKeyValue, Subscriber, TerrainProperty, TestExceptionHandler, ThresholdMonitor, Transformer, Triangulator, UnionDisassembler, Wire, WiredToWireless, WirelessToWired, X10Interface
public class TypedAtomicActor
- extends AtomicActor
- implements TypedActor
A TypedAtomicActor is an AtomicActor whose ports and parameters have types.
The typeConstraintList() method returns the type constraints among
the contained ports and parameters. This base class provides a default
implementation of this method, which should be suitable for most of the
derived classes.
Derived classes may constrain the container by overriding
_checkContainer(). The Ports of TypedAtomicActors are constrained to be
TypedIOPorts. Derived classes may further constrain the ports by
overriding the public method newPort() to create a port of the
appropriate subclass, and the protected method _addPort() to throw an
exception if its argument is a port that is not of the appropriate
subclass.
- Since:
- Ptolemy II 0.2
- Version:
- $Id: TypedAtomicActor.java,v 1.84 2007/12/06 18:18:37 cxh Exp $
- Author:
- Yuhong Xiong
- See Also:
AtomicActor,
TypedCompositeActor,
TypedIOPort,
Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
TypedAtomicActor()
Construct an actor in the default workspace with an empty string
as its name. |
TypedAtomicActor(CompositeEntity container,
java.lang.String name)
Create a new actor in the specified container with the specified
name. |
TypedAtomicActor(Workspace workspace)
Construct an actor in the specified workspace with an empty
string as a name. |
|
Method Summary |
protected void |
_addPort(Port port)
Override the base class to throw an exception if the added port
is not an instance of TypedIOPort. |
void |
attributeTypeChanged(Attribute attribute)
React to a change in the type of an attribute. |
java.lang.Object |
clone()
clone() is not supported, call clone(Workspace workspace)
instead. |
Port |
newPort(java.lang.String name)
Create a new TypedIOPort with the specified name. |
java.util.List |
typeConstraintList()
Return the type constraints of this actor. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, _createReceivers, addActorFiringListener, addInitializable, clone, connectionsChanged, fire, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, 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.util.NamedObj |
_addAttribute, _adjustOverride, _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, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, 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 |
TypedAtomicActor
public TypedAtomicActor()
- Construct an actor in the default workspace with an empty string
as its name. The object is added to the workspace directory.
Increment the version number of the workspace.
TypedAtomicActor
public TypedAtomicActor(Workspace workspace)
- Construct an actor in the specified workspace with an empty
string as a name. You can then change the name with setName().
If the workspace argument is null, then use the default workspace.
The object is added to the workspace directory.
Increment the version number of the workspace.
- Parameters:
workspace - The workspace that will list the entity.
TypedAtomicActor
public TypedAtomicActor(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Create a new 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 name of this actor within the container.
- Throws:
IllegalActionException - If this actor cannot be contained
by the proposed container (see the setContainer() method).
NameDuplicationException - If the name coincides with
an entity already in the container.
attributeTypeChanged
public void attributeTypeChanged(Attribute attribute)
throws IllegalActionException
- React to a change in the type of an attribute. This method is
called by a contained attribute when its type changes.
In this base class, the method informs the director to invalidate
type resolution, if the director is not null.
Thus, by default, attribute type changes cause type resolution to
be redone at the next opportunity.
If an actor does not allow attribute types to change, then it should
override this method.
- Overrides:
attributeTypeChanged in class NamedObj
- Parameters:
attribute - The attribute whose type changed.
- Throws:
IllegalActionException - Not thrown in this base class.
Derived classes can throw this exception if type change is not allowed.
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- clone() is not supported, call clone(Workspace workspace)
instead. Usually it is a mistake for an actor to have a
clone() method and call super.clone(), instead the actor
should have a clone(Workspace workspace) method and
call super.clone(workspace).
- Overrides:
clone in class NamedObj
- Returns:
- A new NamedObj.
- Throws:
java.lang.CloneNotSupportedException - Always thrown.
newPort
public Port newPort(java.lang.String name)
throws NameDuplicationException
- Create a new TypedIOPort with the specified name.
The container of the port is set to this actor.
This method is write-synchronized on the workspace.
- Overrides:
newPort in class AtomicActor
- Parameters:
name - The name for the new port.
- Returns:
- The new port.
- Throws:
NameDuplicationException - If the actor already has a port
with the specified name.- See Also:
Workspace.getWriteAccess()
typeConstraintList
public java.util.List typeConstraintList()
- Return the type constraints of this actor.
The constraints have the form of a list of inequalities.
In this base class, if an input port and an output port do not have
their types declared, and they do not have any constraints stored in
them, a constraint is set up that requires the type of the input
to be less than or equal to the type of the output.
In addition, this method also collects type constraints from the
contained Typeables (ports, variables, and parameters).
This method is read-synchronized on the workspace.
- Specified by:
typeConstraintList in interface TypedActor
- Returns:
- A list of instances of Inequality.
- See Also:
Inequality
_addPort
protected void _addPort(Port port)
throws IllegalActionException,
NameDuplicationException
- Override the base class to throw an exception if the added port
is not an instance of TypedIOPort. This method should not be used
directly. Call the setContainer() method of the port instead.
This method does not set the container of the port to point to
this entity. It assumes that the port is in the same workspace
as this actor.
Derived classes may override this method to further constrain the
port to be a subclass of TypedIOPort. This method is not
synchronized on the workspace, so the caller should be.
- Overrides:
_addPort in class AtomicActor
- Parameters:
port - The port to add to this actor.
- Throws:
IllegalActionException - If the port is not an instance
of TypedIOPort, or the port has no name.
NameDuplicationException - If the port name coincides with
the name of another port already in the actor.