Package ptolemy.data.expr
Class AbstractInitializableParameter
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.kernel.util.AbstractSettableAttribute
-
- ptolemy.data.expr.Variable
-
- ptolemy.data.expr.Parameter
-
- ptolemy.data.expr.AbstractInitializableParameter
-
- All Implemented Interfaces:
java.lang.Cloneable
,Initializable
,HasTypeConstraints
,Typeable
,Changeable
,Debuggable
,DebugListener
,Derivable
,HierarchyListener
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,Settable
,ValueListener
- Direct Known Subclasses:
PortParameter
public abstract class AbstractInitializableParameter extends Parameter implements HierarchyListener, Initializable
An abstract base class for parameters that are preinitialized, initialized, and wrapped up during execution of a model. This takes care of the rather complex adjustments that must be made when the hierarchy changes and also provides default methods.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (eal )
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable
Variable.CircularDependencyError, Variable.VariableScope
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
-
-
Field Summary
-
Fields inherited from class ptolemy.data.expr.Variable
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _valueListeners
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
-
-
Constructor Summary
Constructors Constructor Description AbstractInitializableParameter(NamedObj container, java.lang.String name)
Construct an instance of the attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Initializable
_getInitializableContainer()
Return the first Initializable encountered above this in the hierarchy that will be initialized (i.e., it is either an atomic actor or an opaque composite actor).void
addInitializable(Initializable initializable)
Add the specified object to the set of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object.java.lang.Object
clone(Workspace workspace)
Clone the attribute.void
hierarchyChanged()
Notify this object that the containment hierarchy above it has changed.void
hierarchyWillChange()
Notify this object that the containment hierarchy above it will be changed, which results invoid
initialize()
Invoke initialize() on registered initializables.void
preinitialize()
Invoke preinitialize() on registered initializables.void
removeInitializable(Initializable initializable)
Remove the specified object from the list of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object.void
setContainer(NamedObj container)
Override the base class to register as anInitializable
so that preinitialize() is invoked, and as aHierarchyListener
, so that we are notified of changes in the hiearchy above.void
wrapup()
Invoke wrapup() on registered initializables.-
Methods inherited from class ptolemy.data.expr.Parameter
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
-
Methods inherited from class ptolemy.data.expr.Variable
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, attributeChanged, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, validate, valueChanged
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
Constructor Detail
-
AbstractInitializableParameter
public AbstractInitializableParameter(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an instance of the attribute.- Parameters:
container
- The container.name
- The name.- Throws:
IllegalActionException
- If the superclass throws it.NameDuplicationException
- If the superclass throws it.
-
-
Method Detail
-
addInitializable
public void addInitializable(Initializable initializable)
Add the specified object to the set of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object.- Specified by:
addInitializable
in interfaceInitializable
- Parameters:
initializable
- The object whose methods should be invoked.- See Also:
removeInitializable(Initializable)
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the attribute. This clears the list of initializable objects.
-
hierarchyChanged
public void hierarchyChanged() throws IllegalActionException
Notify this object that the containment hierarchy above it has changed. This method does nothing because instead we usepreinitialize()
to handle re-establishing the connections.- Specified by:
hierarchyChanged
in interfaceHierarchyListener
- Throws:
IllegalActionException
- If the change is not acceptable.
-
hierarchyWillChange
public void hierarchyWillChange() throws IllegalActionException
Notify this object that the containment hierarchy above it will be changed, which results in- Specified by:
hierarchyWillChange
in interfaceHierarchyListener
- Throws:
IllegalActionException
- If unlinking to a published port fails.
-
initialize
public void initialize() throws IllegalActionException
Invoke initialize() on registered initializables.- Specified by:
initialize
in interfaceInitializable
- Throws:
IllegalActionException
- If thrown by a subclass.
-
preinitialize
public void preinitialize() throws IllegalActionException
Invoke preinitialize() on registered initializables.- Specified by:
preinitialize
in interfaceInitializable
- Throws:
IllegalActionException
- If thrown by a subclass.
-
removeInitializable
public void removeInitializable(Initializable initializable)
Remove the specified object from the list of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object. If the specified object is not on the list, do nothing.- Specified by:
removeInitializable
in interfaceInitializable
- Parameters:
initializable
- The object whose methods should no longer be invoked.- See Also:
addInitializable(Initializable)
-
setContainer
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
Override the base class to register as anInitializable
so that preinitialize() is invoked, and as aHierarchyListener
, so that we are notified of changes in the hiearchy above.- Overrides:
setContainer
in classVariable
- Parameters:
container
- The proposed container.- Throws:
IllegalActionException
- If the action would result in a recursive containment structure, or if this entity and container are not in the same workspace.NameDuplicationException
- If the container already has an entity with the name of this entity.- See Also:
Attribute.getContainer()
-
wrapup
public void wrapup() throws IllegalActionException
Invoke wrapup() on registered initializables.- Specified by:
wrapup
in interfaceInitializable
- Throws:
IllegalActionException
- If thrown by a subclass.
-
_getInitializableContainer
protected Initializable _getInitializableContainer()
Return the first Initializable encountered above this in the hierarchy that will be initialized (i.e., it is either an atomic actor or an opaque composite actor).- Returns:
- The first Initializable above this in the hierarchy, or null if there is none.
-
-