Package 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.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$
- Author:
- Edward A. Lee
- See Also:
MoMLChangeRequest
- Pt.AcceptedRating:
- Red (reviewmoderator)
- Pt.ProposedRating:
- Red (eal)
-
-
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 ParserAttribute(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 java.lang.Object
clone(Workspace workspace)
Clone the attribute into the specified workspace.MoMLParser
getParser()
Get the parser.static MoMLParser
getParser(NamedObj object)
Get a parser for the specified object.void
setParser(MoMLParser parser)
Set the parser.-
Methods inherited from class ptolemy.kernel.util.SingletonAttribute
setContainer
-
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, _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
-
-
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
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 classAttribute
- 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)
-
-