ptolemy.kernel.util
Interface Decorator

All Superinterfaces:
Nameable

public interface Decorator
extends Nameable

A decorator is a class that decorates other NamedObj with extra attributes that are specific to both the decorator and the NamedObj.

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).

For a description of a decorator pattern, see http://en.wikipedia.org/wiki/Decorator_pattern.

Since:
Ptolemy II 8.0
Version:
$Id: Decorator.java 59167 2010-09-21 17:08:02Z cxh $
Author:
Bert Rodiers
Accepted Rating:
Red (rodiers)
Proposed Rating:
Red (rodiers)

Method Summary
 DecoratedAttributes createDecoratedAttributes(NamedObj target)
          Return the decorated attributes for the target NamedObj.
 void setTypesOfDecoratedVariables(DecoratedAttributes decoratedAttributes)
          Set the current type of the decorated attributes.
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 

Method Detail

createDecoratedAttributes

DecoratedAttributes createDecoratedAttributes(NamedObj target)
                                              throws IllegalActionException,
                                                     NameDuplicationException
Return the decorated attributes for the target NamedObj.

Parameters:
target - The NamedObj that will be decorated.
Returns:
The decorated attributes for the target NamedObj.
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.

setTypesOfDecoratedVariables

void setTypesOfDecoratedVariables(DecoratedAttributes decoratedAttributes)
                                  throws IllegalActionException
Set the current type of the decorated attributes. The type information of the parameters are not saved in the model hand hence this has to be reset when reading the model again.

Parameters:
decoratedAttributes - The decorated attributes.
Throws:
IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.