Package ptolemy.moml

Class Documentation

  • 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)
    • 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 interface MoMLExportable
        Overrides:
        exportMoML in class StringAttribute
        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()
      • toString

        public java.lang.String toString()
        Get the documentation as a string, with the class name prepended.
        Overrides:
        toString in class NamedObj
        Returns:
        A string describing the object.