Package ptolemy.moml
Class Documentation
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,Settable
public class Documentation extends StringAttribute
An attribute that contains documentation for the container.The name of a documentation object can often be meaningful. Many times the name can be used to specify important information about the type of documentation. Unfortunately, all documentation objects are currently treated the same.
- Since:
- Ptolemy II 0.4
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Yellow (neuendor)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
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.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 Documentation(NamedObj container, java.lang.String name)
Construct an attribute with the specified container and name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
consolidate(NamedObj object)
Return as a single string all the documentation associated with the specified object.void
exportMoML(java.io.Writer output, int depth, java.lang.String name)
Write a MoML description of this object with the specified indentation depth.void
setExpression(java.lang.String expression)
Override the base class to remove this instance from its container if the argument is an empty string.void
setValue(java.lang.String value)
Set the documentation string.java.lang.String
toString()
Get the documentation as a string, with the class name prepended.-
Methods inherited from class ptolemy.kernel.util.StringAttribute
_propagateValue, addValueListener, clone, getExpression, getVisibility, removeValueListener, setVisibility, validate
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression, getValueAsString
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, 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, _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, 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
-
Documentation
public Documentation(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an attribute with the specified container and name. The documentation contained by the attribute is initially empty, but can be set using the setValue() method.- Parameters:
container
- The container.name
- The name of the attribute.- Throws:
IllegalActionException
- If the attribute is not of an acceptable class for the container.NameDuplicationException
- If the name coincides with an attribute already in the container.
-
-
Method Detail
-
consolidate
public static java.lang.String consolidate(NamedObj object)
Return as a single string all the documentation associated with the specified object. Each attribute of type of class Documentation that the object contains contributes to the documentation. The text contributed by each such attribute starts on a new line. If there are no such attributes, then null is returned.- Parameters:
object
- The object to document.- Returns:
- The documentation for the object.
-
exportMoML
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
Write a MoML description of this object with the specified indentation depth. This class is directly supported by the MoML "doc" element, so we generate MoML of the form "<doc>documentation</doc>", where documentation is replaced by the string value of this attribute. If this object is not persistent, then write nothing.- Specified by:
exportMoML
in interfaceMoMLExportable
- Overrides:
exportMoML
in classStringAttribute
- Parameters:
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use instead of the current name.- Throws:
java.io.IOException
- If an I/O error occurs.- See Also:
NamedObj._exportMoMLContents(java.io.Writer, int)
,NamedObj.isPersistent()
-
setExpression
public void setExpression(java.lang.String expression) throws IllegalActionException
Override the base class to remove this instance from its container if the argument is an empty string. The removal is done in a change request, so it may not take effect immediately.- Specified by:
setExpression
in interfaceSettable
- Overrides:
setExpression
in classStringAttribute
- Parameters:
expression
- The value of the string attribute.- Throws:
IllegalActionException
- If the change is not acceptable to the container.- See Also:
StringAttribute.getExpression()
-
setValue
public void setValue(java.lang.String value)
Set the documentation string.- Parameters:
value
- The documentation.- See Also:
AbstractSettableAttribute.getValueAsString()
-
-