org.eidola.kernel
Class Element
java.lang.Object
|
+--org.eidola.kernel.event.EventBroadcaster
|
+--org.eidola.kernel.Container
|
+--org.eidola.kernel.Element
- Direct Known Subclasses:
- NamedElement
- public abstract class Element
- extends Container
A piece of an Eidola program which is owned by another container.
Elements can be as large as a Package, or as small as a numeric
constant in an expression.
Elements sit in a strict hierarchy -- every Element has exactly one
owner
. The chain of owners always reaches up to
a Namespace
. All the elements within the namespace have
unique full name
s; see NamedElement
.
Structure:
See note on synchronization and concurrent read safety in Container
.
- Version:
- [Development version]
- Author:
- Paul Cantrell
Constructor Summary |
Element()
Creates a new empty element. |
OWNER
public static final ContainerPart OWNER
- Part of an element.
- See Also:
StructureChanged
Element
public Element()
- Creates a new empty element. The new element won't be valid
until it has an owner.
getNamespace
public Namespace getNamespace()
- Returns the namespace in which this element lives.
- Overrides:
getNamespace
in class Container
getOwner
public Container getOwner()
- Returns this element's owner.
setOwner
public void setOwner(Container newOwner)
throws CyclicOwner
- Sets this element's owner. This will broadcast a
StructureChanged
notifying that the OWNER
has changed.
- Throws:
CyclicOwner
- If setting this owner would create a
cycle in the chain of owners.
getIndirectOwners
public List getIndirectOwners()
- Returns the list including this container, its owner, its owner's owner,
etc, up to and including the container's namespace.
The list goes from the topmost container down.
Although this is really a derived structure, it is not a member
of Compilation and is not calculated lazily, because this would
often lead to the propogation of unreasonable numbers of events.
getFullName
public List getFullName()
- Returns a list of the names of the chain of containers.
For unnamed elements in the chain, the element itself appears.
Although this is really a derived structure, it is not a member
of Compilation and is not calculated lazily, because this would
often lead to the propogation of unreasonable numbers of events.
- See Also:
NamedElement.getName()
,
toString()
handleOwnerEvent
protected void handleOwnerEvent(ContainerEvent event)
- Propagates events from the owner.
By default, this handler broadcasts a
CompileRequired
event
when it receives a StructureChanged
event from the owner.
toString
public String toString()
- Returns the full name of the element as a nicely formatted string.
- Overrides:
toString
in class Object