public class TypedCompositeActor extends CompositeActor implements TypedActor
When exporting MoML, instances of this class identify their class name as TypedCompositeActor. If a derived class does not change this, then it too will be identified as a TypedCompositeActor. To change this in a derived class, put the following line in the constructor:
setClassName(full class name");
If you do this, you will probably also want to override _exportMoMLContents() to not generate a description of the contents of the composite, since they will be already defined in the Java class.
The ports of a TypedCompositeActor are constrained to be TypedIOPorts, the relations to be TypedIORelations, and the actors to be instances of ComponentEntity that implement the TypedActor interface. Derived classes may impose further constraints by overriding newPort(), _addPort(), newRelation(), _addRelation(), and _addEntity(). Also, derived classes may constrain the container by overriding _checkContainer().
TypedIOPort
,
TypedIORelation
,
TypedActor
,
ComponentEntity
,
CompositeActor
Green (lmuliadi) |
Green (yuhong) |
CompositeEntity.ContainedObjectsIterator
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_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 |
---|
TypedCompositeActor()
Construct a TypedCompositeActor in the default workspace with no
container and an empty string as its name.
|
TypedCompositeActor(CompositeEntity container,
java.lang.String name)
Construct a TypedCompositeActor with a name and a container.
|
TypedCompositeActor(Workspace workspace)
Construct a TypedCompositeActor in the specified workspace with
no container and an empty string as a name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addEntity(ComponentEntity entity)
Add an actor to this container with minimal error checking.
|
protected void |
_addPort(Port port)
Add a port to this actor.
|
protected void |
_addRelation(ComponentRelation relation)
Add a relation to this container.
|
protected java.util.List<Inequality> |
_checkTypesFromTo(TypedIOPort sourcePort,
java.util.List<TypedIOPort> destinationPortList)
Check types from a source port to a group of destination ports,
assuming the source port is connected to all the ports in the
group of destination ports.
|
protected java.util.List<Inequality> |
_destinationTypeConstraints(TypedIOPort source)
Return the type constraints on all connections starting from the
specified source port to all the ports in a group of destination
ports.
|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
void |
attributeTypeChanged(Attribute attribute)
React to a change in the type of an attribute.
|
boolean |
isBackwardTypeInferenceEnabled()
Return true if backward type inference is enabled.
|
Port |
newPort(java.lang.String name)
Create a new TypedIOPort with the specified name.
|
ComponentRelation |
newRelation(java.lang.String name)
Create a new TypedIORelation with the specified name, add it
to the relation list, and return it.
|
static void |
resolveTypes(TypedCompositeActor topLevel)
Do type checking and type resolution on the specified composite actor.
|
java.util.List |
typeConstraintList()
Deprecated.
Use typeConstraints().
|
java.util.Set<Inequality> |
typeConstraints()
Return the type constraints of this typed composite actor.
|
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, preinitialize, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort, wrapup
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, 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, 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
public TypedCompositeActor()
public TypedCompositeActor(Workspace workspace)
workspace
- The workspace that will list the actor.public TypedCompositeActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor.IllegalActionException
- If the container is incompatible
with this actor.NameDuplicationException
- If the name coincides with
an actor already in the container.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- Not thrown in this base class.
Derived classes can throw this exception if type change is not allowed.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 boolean isBackwardTypeInferenceEnabled()
isBackwardTypeInferenceEnabled
in interface TypedActor
public Port newPort(java.lang.String name) throws NameDuplicationException
newPort
in class CompositeActor
name
- The name for the new port.NameDuplicationException
- If this actor already has a
port with the specified name.public ComponentRelation newRelation(java.lang.String name) throws NameDuplicationException
newRelation
in class CompositeActor
name
- The name for the new TypedIORelation.NameDuplicationException
- If name collides with a name
already on the container's contents list.public static void resolveTypes(TypedCompositeActor topLevel) throws TypeConflictException
topLevel
- The top level TypedCompositeActor.java.lang.IllegalArgumentException
- If the specified actor is not the
top level container. That is, its container is not null.TypeConflictException
- If a type conflict is detected.public java.util.Set<Inequality> typeConstraints() throws IllegalActionException
This method is read-synchronized on the workspace.
typeConstraints
in interface TypedActor
IllegalActionException
- If the typeConstraints
of one of the deeply contained objects throws it.Inequality
@Deprecated public java.util.List typeConstraintList() throws IllegalActionException
IllegalActionException
- If thrown while constructing
the set of type constraints.Inequality
protected void _addEntity(ComponentEntity entity) throws IllegalActionException, NameDuplicationException
_addEntity
in class CompositeActor
entity
- TypedActor to contain.IllegalActionException
- If the actor has no name, or the
action would result in a recursive containment structure, or the
argument does not implement the TypedActor interface.NameDuplicationException
- If the name collides with a name
already on the actor contents list.protected void _addPort(Port port) throws IllegalActionException, NameDuplicationException
_addPort
in class CompositeActor
port
- The TypedIOPort to add to this actor.IllegalActionException
- If the port class is not
acceptable to this actor, or the port has no name.NameDuplicationException
- If the port name collides with a
name already in the actor.protected void _addRelation(ComponentRelation relation) throws IllegalActionException, NameDuplicationException
_addRelation
in class CompositeActor
relation
- The TypedIORelation to contain.IllegalActionException
- If the relation has no name, or is
not an instance of TypedIORelation.NameDuplicationException
- If the name collides with a name
already on the contained relations list.protected java.util.List<Inequality> _checkTypesFromTo(TypedIOPort sourcePort, java.util.List<TypedIOPort> destinationPortList)
sourcePort
- The source port.destinationPortList
- A list of destination ports.protected java.util.List<Inequality> _destinationTypeConstraints(TypedIOPort source)
source
- The source port.