ptolemy.domains.modal.kernel
Class ContainmentExtender

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.domains.modal.kernel.ContainmentExtender
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainmentExtender, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class ContainmentExtender
extends Attribute
implements ContainmentExtender

An implementation of containment extender for modal models as an attribute. This attribute defines a special containment relationship that is slightly different from the containment relationship defined by NamedObj.getContainer(). The getExtendedContainer() method returns the container of the object that contains the implementing attribute. The returned container is supposed to be the object that visually contains the object that owns the implementing attribute, as seen by the model designer. In particular, for a modal model (either FSM or Ptera), even though a refinement is visually contained by a state or an event, NamedObj.getContainer() of that refinement does not return the state or event because of a difference between the visual representation and internal data representation. In that case, getExtendedContainer() of this class returns the state or event.

Since:
Ptolemy II 8.0
Version:
$Id: ContainmentExtender.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Red (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
ContainmentExtender(RefinementActor container, java.lang.String name)
          Construct a ContainmentExtender attribute with the given name contained by the specified Refinement.
ContainmentExtender(State container, java.lang.String name)
          Construct a ContainmentExtender attribute with the given name contained by the specified State.
 
Method Summary
 NamedObj getContainedObject(java.lang.String name)
          Get an object with the given name within the container.
 NamedObj getExtendedContainer()
          Get the extended container.
 
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
 

Constructor Detail

ContainmentExtender

public ContainmentExtender(RefinementActor container,
                           java.lang.String name)
                    throws IllegalActionException,
                           NameDuplicationException
Construct a ContainmentExtender attribute with the given name contained by the specified Refinement. 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.
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.

ContainmentExtender

public ContainmentExtender(State container,
                           java.lang.String name)
                    throws IllegalActionException,
                           NameDuplicationException
Construct a ContainmentExtender attribute with the given name contained by the specified State. 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.
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.
Method Detail

getContainedObject

public NamedObj getContainedObject(java.lang.String name)
                            throws IllegalActionException
Get an object with the given name within the container.

Specified by:
getContainedObject in interface ContainmentExtender
Parameters:
name - The name of the object.
Returns:
The object, or null if not found.
Throws:
IllegalActionException - If the refinement of the containing state cannot be found, or if a comma-separated list is malformed.

getExtendedContainer

public NamedObj getExtendedContainer()
                              throws IllegalActionException
Get the extended container.

Specified by:
getExtendedContainer in interface ContainmentExtender
Returns:
The container.
Throws:
IllegalActionException - If the specified refinement cannot be found in a state, or if a comma-separated list is malformed.