Package ptolemy.kernel.util.test
Class TestInstantiableAttribute
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.kernel.util.test.TestInstantiableAttribute
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class TestInstantiableAttribute extends Attribute implements Instantiable
-
-
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, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description TestInstantiableAttribute()
TestInstantiableAttribute(NamedObj container, java.lang.String name)
TestInstantiableAttribute(Workspace workspace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List
getChildren()
Return a list of weak references to instances of Instantiable that are children of this object.Instantiable
getParent()
Return the parent of this object, or null if there is none.Instantiable
instantiate(NamedObj container, java.lang.String name)
Create an instance by (deeply) cloning this object and then adjusting the parent-child relationships between the clone and its parent.boolean
isClassDefinition()
Return true if this object is a class definition, which means that it can be instantiated.-
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, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, 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
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, getPrototypeList, propagateExistence, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
TestInstantiableAttribute
public TestInstantiableAttribute()
-
TestInstantiableAttribute
public TestInstantiableAttribute(Workspace workspace)
-
TestInstantiableAttribute
public TestInstantiableAttribute(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
-
-
Method Detail
-
getChildren
public java.util.List getChildren()
Description copied from interface:Instantiable
Return a list of weak references to instances of Instantiable that are children of this object. An implementor of this method may return null or an empty list to indicate that there are no children.- Specified by:
getChildren
in interfaceInstantiable
- Returns:
- An unmodifiable list of instances of java.lang.ref.WeakReference that refer to instances of Instantiable or null if this object has no children.
-
getParent
public Instantiable getParent()
Description copied from interface:Instantiable
Return the parent of this object, or null if there is none.- Specified by:
getParent
in interfaceInstantiable
- Returns:
- The parent of this object, or null if there is none.
-
instantiate
public Instantiable instantiate(NamedObj container, java.lang.String name) throws java.lang.CloneNotSupportedException, IllegalActionException, NameDuplicationException
Description copied from interface:Instantiable
Create an instance by (deeply) cloning this object and then adjusting the parent-child relationships between the clone and its parent. Specifically, the clone defers its definition to this object, which becomes its "parent." The "child" inherits all the objects contained by this object. If this object is a composite, then this method must adjust any parent-child relationships that are entirely contained within the child. That is, for any parent-child relationship that is entirely contained within this object (i.e., both the parent and the child are deeply contained by this object), a corresponding parent-child relationship is created within the clone such that both the parent and the child are entirely contained within the clone.The new object is not a class definition by default (it is an "instance" rather than a "class"). That is,
Instantiable.isClassDefinition()
returns false.- Specified by:
instantiate
in interfaceInstantiable
- Parameters:
container
- The container for the instance, or null to instantiate it at the top level.name
- The name for the instance.- Returns:
- A new instance that is a clone of this object with adjusted deferral relationships.
- Throws:
java.lang.CloneNotSupportedException
- If this object cannot be cloned.IllegalActionException
- If this object is not a class definition or the proposed container is not acceptable.NameDuplicationException
- If the name collides with an object already in the container.
-
isClassDefinition
public boolean isClassDefinition()
Description copied from interface:Instantiable
Return true if this object is a class definition, which means that it can be instantiated.- Specified by:
isClassDefinition
in interfaceInstantiable
- Returns:
- True if this object is a class definition.
-
-