public class TypedAtomicActor extends AtomicActor<TypedIOPort> implements TypedActor
The final method typeConstraints() returns the type constraints among the contained ports and parameters. It gathers these constraints by invoking three different protected methods (listed in order of execution):
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.
AtomicActor
,
TypedCompositeActor
,
TypedIOPort
Green (cxh) |
Green (cxh) |
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected boolean |
_typesValid
Whether or not the resolved types are still valid.
|
_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 |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<Inequality> |
_containedTypeConstraints()
Collect all type constraints from contained Typeables (ports,
variables, and parameters).
|
protected java.util.Set<Inequality> |
_customTypeConstraints()
Empty stub to be used for setting up custom type constraints for
subclasses of this actor.
|
protected java.util.Set<Inequality> |
_defaultTypeConstraints()
Return the default type constraints.
|
protected void |
_fireAt(double time)
Request a firing of this actor at the specified time
and throw an exception if the director does not agree to
do it at the requested time.
|
protected void |
_fireAt(Time time)
Request a firing of this actor at the specified time
and throw an exception if the director does not agree to
do it at the requested time.
|
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.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
boolean |
isBackwardTypeInferenceEnabled()
Return true if backward type inference is enabled in the first opaque
composite actor up the hierarchy, or false otherwise.
|
Port |
newPort(java.lang.String name)
Create a new TypedIOPort with the specified name.
|
java.util.List<Inequality> |
typeConstraintList()
Deprecated.
Use typeConstraints().
|
java.util.Set<Inequality> |
typeConstraints()
Return the type constraints of this actor.
|
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, 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, attributeChanged, 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
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
protected boolean _typesValid
public TypedAtomicActor()
public TypedAtomicActor(Workspace workspace)
workspace
- The workspace that will list the entity.public TypedAtomicActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor within the container.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.public void attributeTypeChanged(Attribute attribute) throws IllegalActionException
attributeTypeChanged
in class NamedObj
attribute
- The attribute whose type changed.IllegalActionException
- Not thrown in this base class.
Derived classes can throw this exception if type change is not allowed.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class AtomicActor<TypedIOPort>
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 boolean isBackwardTypeInferenceEnabled()
isBackwardTypeInferenceEnabled
in interface TypedActor
public Port newPort(java.lang.String name) throws NameDuplicationException
newPort
in class AtomicActor<TypedIOPort>
name
- The name for the new port.NameDuplicationException
- If the actor already has a port
with the specified name.Workspace.getWriteAccess()
public final java.util.Set<Inequality> typeConstraints()
_customTypeConstraints()
is called. This method is
defined as an empty stub in the base class, that is to be overridden by
subclasses that require a specific set of constraints to be setup.
Second, _defaultTypeConstraints()
is called. Its purpose is
to setup type constraints between inputs and outputs that have no types
declared. It ensures that outputs are greater than or equal to inputs,
meaning that lossless conversion is possible on the tokens that pass
through the actor.
Finally, _containedTypeConstraints()
is called to collect
all type constraints that are stored in the contained Typeables.
Note that all constraints are cached and only recomputed if necessary.
This method is read-synchronized on the workspace.typeConstraints
in interface TypedActor
Inequality
@Deprecated public java.util.List<Inequality> typeConstraintList()
Inequality
protected java.util.Set<Inequality> _containedTypeConstraints()
protected java.util.Set<Inequality> _defaultTypeConstraints()
protected java.util.Set<Inequality> _customTypeConstraints()
protected void _fireAt(Time time) throws IllegalActionException
time
- The requested time.IllegalActionException
- If the director does not
agree to fire the actor at the specified time, or if there
is no director.protected void _fireAt(double time) throws IllegalActionException
time
- The requested time, as a double.IllegalActionException
- If the director does not
agree to fire the actor at the specified time, or if there is
no director.