ptolemy.kernel.util
Class DecoratedAttributes
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.DecoratedAttributes
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- DecoratedAttributesImplementation
public abstract class DecoratedAttributes
- extends Attribute
An abstract class that represents a number of decorated attributed.
A NamedObj can contain DecoratedAttributes. These are attributes that are
added by another NamedObj, called a decorator to this NamedObj.
An example is for example a code generator. This one has specific attributes
for for example the generated code of the director in a model. These attributes
are added by the Decorator (the code generator), to the director ("this" object).
These attributes are stored seperately and can be retrieved by using
NamedObj.getDecoratorAttributes(Decorator) or
NamedObj.getDecoratorAttributes(Decorator).
A DecoratedAttributes instance has a decorator and
attributes, the decorated attributes.
The container of this class is the object that is being decorated.
The implementation class is DecoratedAttributesImplementation, the
functionality is divided in two classes to solve dependency issues.
- Since:
- Ptolemy II 8.0
- Version:
- $Id: DecoratedAttributes.java 55338 2009-08-01 01:29:23Z cxh $
- Author:
- Bert Rodiers
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_attributes, _changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
DecoratedAttributes(NamedObj container,
java.lang.String name)
Construct a DecoratedAttributes instance with the given name and the container of the decorator. |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DecoratedAttributes
public DecoratedAttributes(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct a DecoratedAttributes instance with the given name and the container of the decorator.
The container argument must not be null, or a
NullPointerException will be thrown. This attribute will use the
workspace of the container for synchronization and version counts.
If the name argument is null, then the name is set to the empty string.
Increment the version of the workspace.
- Parameters:
container - The container of this object.name - The name of this attribute.
- Throws:
IllegalActionException - If the attribute is not of an
acceptable class for the container, or if the name contains a period.
NameDuplicationException - If the name coincides with
an attribute already in the container.
exportToMoML
public void exportToMoML(NamedObj container,
java.io.Writer output,
int depth)
throws InvalidStateException,
java.io.IOException
- Export the Decorated attributes. This is a special method
where we don't store the Decorated Attributes directly in the
container, but we do it is another container (typically the container
of the decorator) to make sure that when the model is parsed again,
both the container of this object and the decorator are already parsed
and hence all links can be corrected.
- Parameters:
container - The container in which we store the the attribute.
This typically is the container of the decorator.output - The output stream to write to.depth - The depth in the hierarchy, to determine indenting.
- Throws:
java.io.IOException - If an I/O error occurs.
InvalidStateException - If a recursive structure is
encountered, where this object directly or indirectly contains
itself. Note that this is a runtime exception so it need not
be declared explicitly.
getDecorator
public abstract Decorator getDecorator()
- Return the decorator.
- Returns:
- The decorator.
_decoratorPath
protected abstract StringAttribute _decoratorPath()
- Return the decorator path. It is the full path of the
decorator in the model.
This variable is used for persistence to recreate
the code generator after having parsed the model.
- Returns:
- The full path of the decorator in the model.
_register
protected final void _register()
throws NameDuplicationException,
IllegalActionException
- Register this attribute again to the container. This is necessary, since when
opening the model, the decorator is not directly know, the container doesn't
have the mapping between attribute and decorator.
- Throws:
NameDuplicationException - If the container already
has an attribute with the same name.
IllegalActionException - If the attribute is not an
an instance of the expect class (in derived classes).