ptolemy.moml
Class ParserAttribute
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.SingletonAttribute
ptolemy.moml.ParserAttribute
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Singleton
public class ParserAttribute
- extends SingletonAttribute
This attribute represents a MoML parser.
If it is present in an entity that is the context for a MoMLChangeRequest,
then that change request will use it to parse the changes.
It is not a persistent attribute (exportMoML() writes nothing).
It is a singleton, meaning that if it is inserted into a container
that already contains a singleton attribute with the same name,
then it will replace the previous attribute.
By default, this attribute is not persistent, so it will not
be present in a MoML representation of its container.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: ParserAttribute.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
MoMLChangeRequest
,
Serialized Form
- Accepted Rating:
- Proposed Rating:
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 |
ParserAttribute(NamedObj container,
java.lang.String name)
Construct an attribute with the specified container and name. |
Methods inherited from class ptolemy.kernel.util.Attribute |
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, 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 |
_parser
private MoMLParser _parser
ParserAttribute
public ParserAttribute(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an attribute with the specified container and name.
- 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.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the attribute into the specified workspace. The
resulting object a null value for the value of the parser.
- Overrides:
clone
in class Attribute
- Parameters:
workspace
- The workspace for the cloned object.
- Returns:
- A new attribute.
- Throws:
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
getParser
public MoMLParser getParser()
- Get the parser. If none has been set, then return a new one.
- Returns:
- A MoML parser.
- See Also:
setParser(MoMLParser)
getParser
public static MoMLParser getParser(NamedObj object)
- Get a parser for the specified object. This searches up the
hierarchy until it finds a container of the specified object
that contains an instance of ParserAttribute. If none is
found, then a new ParserAttribute is created at the top level.
- Parameters:
object
- The object for which to find an associated parser.
- Returns:
- The parser for the specified object.
- Throws:
java.lang.NullPointerException
- If the argument is null.- See Also:
setParser(MoMLParser)
setParser
public void setParser(MoMLParser parser)
- Set the parser.
- Parameters:
parser
- The parser.- See Also:
getParser()
,
getParser(NamedObj)