This is a base class for almost all Ptolemy II objects.
<p>
This class supports a naming scheme, change requests, a persistent
file format (MoML), a mutual exclusion mechanism for models (the
workspace), an error handler, and a hierarchical class mechanism
with inheritance.
<p>
An instance of this class can also be parameterized by attaching
instances of the Attribute class.
Instances of Attribute can be attached by calling their setContainer()
method and passing this object as an argument. Those instances will
then be reported by the <a href="../../../ptolemy/kernel/util/NamedObj.html#getAttribute">getAttribute(String)</a>,
<a href="../../../ptolemy/kernel/util/NamedObj.html#getAttribute">getAttribute(String, Class)</a>, <a href="../../../ptolemy/kernel/util/NamedObj.html#attributeList">attributeList()</a>
and <a href="../../../ptolemy/kernel/util/NamedObj.html#attributeList">attributeList(Class)</a> methods.
Classes derived from NamedObj may constrain attributes to be a
subclass of Attribute. To do that, they should override the protected
_addAttribute(Attribute) method to throw an exception if
the object provided is not of the right class.
<p>
An instance of this class has a name.
A name is an arbitrary string with no periods. If no
name is provided, the name is taken to be an empty string (not a null
reference). An instance also has a full name, which is a concatenation
of the container's full name and the simple name, separated by a
period. If there is no container, then the full name begins with a
period. The full name is used for error reporting throughout Ptolemy
II.
<p>
Instances of this class are associated with a workspace, specified as
a constructor argument. The reference to the workspace is immutable.
It cannot be changed during the lifetime of this object. It is used for
synchronization of methods that depend on or modify the state of
objects within it. If no workspace is specified, then the default
workspace is used. Note that the workspace should not be confused
with the container. The workspace never serves as a container.
<p>
In this base class, the container is null by default, and no
method is provided to change it. Derived classes that support
hierarchy provide one or more methods that set the container.
By convention, if the container is set,
then the instance should be removed from the workspace directory, if
it is present. The workspace directory is expected to list only
top-level objects in a hierarchy. The NamedObj can still use the
workspace for synchronization. Any object contained by another uses
the workspace of its container as its own workspace by default.
<p>
This class supports <i>change requests</i> or <i>mutations</i>,
which are changes to a model that are performed in a disciplined
fashion. In particular, a mutation can be requested via the
<a href="../../../ptolemy/kernel/util/NamedObj.html#requestChange">requestChange(ChangeRequest)</a> method. By default, when
a change is requested, the change is executed immediately.
However, by calling <a href="../../../ptolemy/kernel/util/NamedObj.html#setDeferringChangeRequests">setDeferringChangeRequests(boolean)</a>,
you can ensure that change requests are queued to be executed
only when it is safe to execute them.
<p>
This class supports the notion of a <i>model error</i>, which is
an exception that is handled by a registered model error handler, or
passed up the container hierarchy if there is no registered model
error handler. This mechanism complements the exception mechanism in
Java. Instead of unraveling the calling stack to handle exceptions,
this mechanism passes control up the Ptolemy II hierarchy.
<p>
Derived classes should override the _description() method to
append new fields if there is new information that should be included
in the description.
<p>
A NamedObj can contain instances of <a href="../../../ptolemy/kernel/util/DecoratorAttributes.xml">ptolemy.kernel.util.DecoratorAttributes</a>. These are attributes that are
added by another NamedObj that implements the <a href="../../../ptolemy/kernel/util/Decorator.xml">ptolemy.kernel.util.Decorator</a> interface.
These attributes are stored separately and can be retrieved by using
<a href="../../../ptolemy/kernel/util/NamedObj.html#getDecoratorAttributes">getDecoratorAttributes(Decorator)</a> or
<a href="../../../ptolemy/kernel/util/NamedObj.html#getDecoratorAttribute">getDecoratorAttribute(Decorator, String)</a>.
Mudit Goel, Edward A. Lee, Neil Smyth, Contributor: Bert Rodiers
$Id: NamedObj.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 0.2
Green (eal)
Green (cxh)