org.eidola.kernel
Class NamedElement
java.lang.Object
|
+--org.eidola.kernel.event.EventBroadcaster
|
+--org.eidola.kernel.Container
|
+--org.eidola.kernel.Element
|
+--org.eidola.kernel.NamedElement
- Direct Known Subclasses:
- Capsule, Function, Variable
- public abstract class NamedElement
- extends Element
An element which occupies a place in the namespace.
A named element has a name -- its own unique name within its
owner. It also has a full name, which is just the chain of
names of its indirect owners. See getName()
, Element.getFullName()
,
and Element.toString()
.
Named elements can specialize
other named elements. Element B specializes element A if B can be
used in a context that expect something looking like A. This
specializing construction forms the basis of Eidola's type and inheritence systems --
see Class
for more on this.
A named element has a signature, which is
the parts of this element's structure or its contents' structures
which will affect the result of NamedElement.Compilation.specializes(NamedElement other)
for this element, plus the name.
Structure:
Signature:
See note on synchronization and concurrent read safety in Container
.
- Version:
- [Development version]
- Author:
- Paul Cantrell
- See Also:
Class
,
Package
,
Function
,
Variable
Constructor Summary |
NamedElement()
Creates a new named element with an empty name. |
Method Summary |
void |
broadcastEvent(Event event)
Broadcasts an event about changes in this element, incrementing
appropriate modification counts. |
String |
getName()
Returns this element's name within its container. |
long |
getSignatureVersion()
Returns a modification count for this element's signature. |
void |
setName(String newName)
Sets this element's name. |
NAME
public static final ContainerPart NAME
NamedElement
public NamedElement()
- Creates a new named element with an empty name.
getName
public String getName()
- Returns this element's name within its container. For example,
the name of the element "package.SomeClass.f.x" is "x".
setName
public void setName(String newName)
- Sets this element's name. This changes the element's structure
and its signature.
You must synchronize on the element when calling this method.
getSignatureVersion
public long getSignatureVersion()
- Returns a modification count for this element's signature. The
signature is the parts of this element's structure or its
contents' structures which will affect
specialization
on this element, plus the name of the element.
broadcastEvent
public void broadcastEvent(Event event)
- Broadcasts an event about changes in this element, incrementing
appropriate modification counts.
- Overrides:
broadcastEvent
in class Container
- Parameters:
event
- The event to broadcast.