public class MirrorDecorator extends TypedAtomicActor implements Decorator
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Parameter> |
_addedParameters
A list containing the user added parameters.
|
protected java.util.List<java.lang.String> |
_addedPortNames
A list containing the names of user added ports.
|
protected java.util.List<java.lang.String> |
_addedPortParameterNames
A list containing the names of user added port parameters.
|
protected java.util.List<NamedObj> |
_decoratedObjects
Cached list of decorated objects.
|
protected long |
_decoratedObjectsVersion
Version for _decoratedObjects.
|
protected java.util.ArrayList<MirrorDecoratorListener> |
_listeners
Listeners registered to receive events from this object.
|
_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 |
---|
MirrorDecorator(CompositeEntity container,
java.lang.String name)
Construct a MirrorDecorator with a name and a container.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addAttribute(Attribute attr)
Add an attribute.
|
protected void |
_addPort(TypedIOPort port)
Add a port to this entity.
|
protected void |
_removeAttribute(Attribute attr)
Remove the given attribute.
|
protected void |
_removePort(Port port)
Remove the specified port.
|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
DecoratorAttributes |
createDecoratorAttributes(NamedObj target)
Create and return the decorated attributes for the target NamedObj.
|
java.util.List<NamedObj> |
decoratedObjects()
Return the decorated objects.
|
java.util.List<Parameter> |
getAddedParameters()
Return the added paramters.
|
java.util.List<java.lang.String> |
getAddedPortNames()
Return the added port names.
|
java.util.List<java.lang.String> |
getAddedPortParameterNames()
Return the added port parameter names.
|
boolean |
isGlobalDecorator()
Return true to indicate that this decorator should
decorate objects across opaque hierarchy boundaries.
|
void |
registerListener(MirrorDecoratorListener monitor)
Add a communication aspect monitor to the list of listeners.
|
void |
sendParameterEvent(MirrorDecoratorListener.DecoratorEvent eventType,
Parameter parameter)
Notify the monitor that an event happened.
|
void |
sendPortEvent(MirrorDecoratorListener.DecoratorEvent eventType,
java.lang.String portName)
Notify the monitor that an event happened.
|
void |
setContainer(CompositeEntity container)
Override the base class to first set the container, then establish
a connection with any decorated objects it finds in scope in the new
container.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_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, stop, stopFire, terminate, wrapup
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_description, _exportMoMLContents, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _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
description, getContainer, getDisplayName, getFullName, getName, getName, setName
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, preinitialize, removeInitializable, wrapup
getDerivedLevel, getDerivedList, propagateValue
protected java.util.List<NamedObj> _decoratedObjects
protected long _decoratedObjectsVersion
protected java.util.ArrayList<MirrorDecoratorListener> _listeners
protected java.util.List<java.lang.String> _addedPortNames
protected java.util.List<java.lang.String> _addedPortParameterNames
protected java.util.List<Parameter> _addedParameters
public MirrorDecorator(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
NamedObj
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).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 any of the attributes
cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public DecoratorAttributes createDecoratorAttributes(NamedObj target)
Decorator
DecoratorAttributes
. Implementations should populate that attribute
with parameters that have appropriate default values.
This method is called if NamedObj.getDecoratorAttribute(Decorator, String)
or NamedObj.getDecoratorAttributes(Decorator)
is called,
and the specified target object does not already have
decorated attributes for this decorator.
The implementer of this method is responsible for ensuring consistency
with the Decorator.decoratedObjects()
method. Specifically, any
object returned by Decorator.decoratedObjects()
, when passed as an argument
to this method, should not result in a null returned value. And conversely,
any object passed to this method that is not in the list returned by
decoratedObjects() should result in a null returned value.
createDecoratorAttributes
in interface Decorator
target
- The NamedObj that will be decorated.public java.util.List<NamedObj> decoratedObjects() throws IllegalActionException
decoratedObjects
in interface Decorator
IllegalActionException
- If some object cannot be determined to
be decorated or not (e.g., a parameter cannot be evaluated).public java.util.List<java.lang.String> getAddedPortNames()
public java.util.List<java.lang.String> getAddedPortParameterNames()
public java.util.List<Parameter> getAddedParameters()
public boolean isGlobalDecorator()
isGlobalDecorator
in interface Decorator
public void registerListener(MirrorDecoratorListener monitor)
monitor
- The communication aspect monitor.public void sendPortEvent(MirrorDecoratorListener.DecoratorEvent eventType, java.lang.String portName)
eventType
- Type of event.portName
- Name of port to be added/removedpublic void sendParameterEvent(MirrorDecoratorListener.DecoratorEvent eventType, Parameter parameter)
eventType
- Type of event.parameter
- Parameter to be added/removedpublic void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException
setContainer
in class AtomicActor<TypedIOPort>
container
- The container to attach this attribute to..IllegalActionException
- If this attribute is not of the
expected class for the container, or it has no name,
or the attribute and container are not in the same workspace, or
the proposed container would result in recursive containment.NameDuplicationException
- If the container already has
an attribute with the name of this attribute.ComponentEntity.getContainer()
protected void _addPort(TypedIOPort port) throws IllegalActionException, NameDuplicationException
Entity
_addPort
in class Entity<TypedIOPort>
port
- The port to add to this entity.IllegalActionException
- If the port has no name.NameDuplicationException
- If the port name collides with a
name already in the entity.protected void _removePort(Port port)
Entity
_removePort
in class Entity<TypedIOPort>
port
- The port being removed from this entity.protected void _addAttribute(Attribute attr) throws NameDuplicationException, IllegalActionException
NamedObj
This method is write-synchronized on the workspace and increments its version number.
_addAttribute
in class NamedObj
attr
- The attribute to be added.NameDuplicationException
- If this object already
has an attribute with the same name.IllegalActionException
- If the attribute is not an
an instance of the expect class (in derived classes).protected void _removeAttribute(Attribute attr)
NamedObj
_removeAttribute
in class NamedObj
attr
- The attribute to be removed.