ptolemy.kernel.util
Interface Nameable
- All Known Subinterfaces:
- Actor, BranchActor, CTDynamicActor, CTEventGenerator, CTStatefulActor, CTStepSizeControlActor, CTWaveformGenerator, Derivable, ExplicitChangeContext, Instantiable, Locatable, MoMLExportable, Settable, TMActor, TypedActor, WirelessChannel
- All Known Implementing Classes:
- AbstractSettableAttribute, AtomicActor, AtomicWirelessChannel, AttributeValueAttribute, Barrier, CompositeActor, ConfigurableAttribute, CSPActor, CTBaseIntegrator, CTCase, CTCompositeActor, CTPeriodicSampler, CTRefinement, CTTriggeredSampler, FirstOrderHold, FSMActor, FSMDirector, InstantiableNamedObj, LevelCrossingDetector, Location, LocationParameter, NamedObj, SetVariable, ThresholdMonitor, TMCompositeFacade, TypedAtomicActor, TypedCompositeActor, TypeOpaqueCompositeActor, VariableLattice, VariableRecursiveLattice, Workspace, ZeroOrderHold
- public interface Nameable
This is an interface for objects with a name and a container. A simple
name is an arbitrary string that identifies the object in the context of
its container. In addition, the interface supports a
"full name" which in implementation should identify both the container
and the individual object. The implementations in the kernel package
define the full name of an object to be the full name of its container
followed by a period followed by the simple name of the object.
Periods and braces are not permitted in the name.
- Since:
- Ptolemy II 0.2
- Version:
- $Id: Nameable.java,v 1.54 2006年08月21日 23:15:57 cxh Exp $
- Author:
- Christopher Hylands, Edward A. Lee
- Accepted Rating:
Green (johnr)
- Proposed Rating:
Green (eal)
|
Method Summary |
java.lang.String |
description()
Return a description of the object. |
NamedObj |
getContainer()
Return the container. |
java.lang.String |
getDisplayName()
Return a name to present to the user. |
java.lang.String |
getFullName()
Return the full name, which reflects the container object, if there
is one. |
java.lang.String |
getName()
Return the name of the object. |
java.lang.String |
getName(NamedObj relativeTo)
Get the name of this object relative to the specified container.
|
void |
setName(java.lang.String name)
Set or change the name. |
description
public java.lang.String description()
- Return a description of the object. The general
form of the description is a space-delimited list of the form
"className fullName keyword field keyword field ...".
If any of the items contain spaces, then they must be surrounded
by braces, as in "{two words}". Return characters or newlines
may be be used as delimiters as well. The fields are usually
lists of descriptions of this same form, although different
forms can be used for different keywords. The keywords are
extensible, but the following are in use: links, ports, entities,
relations, attributes, and inside links, at least.
- Returns:
- A description of this object.
getContainer
public NamedObj getContainer()
- Return the container.
- Returns:
- The contain.er
getDisplayName
public java.lang.String getDisplayName()
- Return a name to present to the user.
- Returns:
- A name to present to the user.
getFullName
public java.lang.String getFullName()
- Return the full name, which reflects the container object, if there
is one. For example the implementation in NamedObj concatenates the
full name of the container objects with the name of the this object,
separated by periods.
- Returns:
- The full name of the object.
getName
public java.lang.String getName()
- Return the name of the object.
- Returns:
- The name of the object.
- See Also:
setName(String)
getName
public java.lang.String getName(NamedObj relativeTo)
throws InvalidStateException
- Get the name of this object relative to the specified container.
If this object is contained directly by the specified container,
this is just its name, as returned by getName(). If it is deeply
contained by the specified container, then the relative name is
x1.x2. ... .name, where x1 is directly
contained by the specified container, x2 is contained by
x1, etc. If this object is not deeply contained by the
specified container, then this method returns the full name of
this object, as returned by getFullName().
- Parameters:
relativeTo - The object relative to which you want the name.
- Returns:
- A string of the form "name2...nameN".
- Throws:
InvalidStateException - If a recursive structure is
encountered, where this object directly or indirectly contains
itself. Note that this is a runtime exception so it need not
be declared explicitly.- See Also:
setName(String)
setName
public void setName(java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Set or change the name. By convention, if the argument is null,
the name should be set to an empty string rather than to null.
- Parameters:
name - The new name.
- Throws:
IllegalActionException - If the name contains a period.
NameDuplicationException - If the container already
contains an object with this name.- See Also:
getName(),
getName(NamedObj)