Eidola home

org.eidola.kernel
Class Class

java.lang.Object
  |
  +--org.eidola.kernel.event.EventBroadcaster
        |
        +--org.eidola.kernel.Container
              |
              +--org.eidola.kernel.Element
                    |
                    +--org.eidola.kernel.NamedElement
                          |
                          +--org.eidola.kernel.Capsule
                                |
                                +--org.eidola.kernel.Class

public class Class
extends Capsule

An Eidola type.

Eidola determines type by the generalization relationship: a class explicitly declares which other classes are its parents, and the generalization relationship is then a transitive, reflexive relation over the chain of parents; see Class.Compilation.getGeneralizations().

For a class to legally claim another as its generalization, it must have a matching subsignature. This means that (this is the Big Important Rule here) for every public member of every parent class, there must be a matching public member of the child class.

Familiar object-oriented languages will implicitly inherit members, but the Big Important Rule means that in Eidola, subclasses explicitly declare when they are inheriting a member. To allow inheritance, the public members of a class fall under a slightly relaxed membership rule: instead of requiring that a class own all of its public members, any generalization of the class may own them. It is therefore possible for a class to borrow members from its generalizations.

Private members necessarily get inherited from generalizations, but this only happens at runtime and is invisible to static typing and scoping, so it's safe to ignore it for now.

A class can claim multiple parents. In fact, since all potentially ambiguous inheritance happens explicitly, it is fine to have a cycle in the generalization graph. Yes, it seems strange, but it's fine when you work through it -- all this means is that all the classes in the cycle have identical signatures.

Structure:

Signature:

See note on synchronization and concurrent read safety in Container.

Version:
[Development version]
Author:
Paul Cantrell

Inner Class Summary
 class Class.Compilation
           
 
Inner classes inherited from class org.eidola.kernel.Capsule
Capsule.Compilation
 
Inner classes inherited from class org.eidola.kernel.NamedElement
NamedElement.Compilation
 
Inner classes inherited from class org.eidola.kernel.Element
Element.Compilation
 
Inner classes inherited from class org.eidola.kernel.Container
Container.Compilation
 
Field Summary
static ContainerPart PARENTS
          Part of an element.
 
Fields inherited from class org.eidola.kernel.Capsule
PRIVATE_MEMBERS, PUBLIC_MEMBERS
 
Fields inherited from class org.eidola.kernel.NamedElement
NAME
 
Fields inherited from class org.eidola.kernel.Element
OWNER
 
Fields inherited from class org.eidola.kernel.Container
CONTENTS, debugCompile
 
Fields inherited from class org.eidola.kernel.event.EventBroadcaster
debugEvents
 
Constructor Summary
Class()
          Creates a new empty class.
 
Method Summary
 void addParent(Class parent)
          Adds a parent.
 void dump(int i)
          Does a debug dump of this container to System.out.
 Set getParents()
          Returns the set of parents, the generalizations this class explicitly declares.
 void handleContentEvent(ContainerEvent event)
          Handles an event passed on from a member.
 void handleParentEvent(ContainerEvent event)
          Handles an event passed on from a parent.
protected  Container.Compilation makeNewCompilation()
          Creates a new Class.Compilation of an appropriate type for this container.
 void removeParent(Class parent)
          Removes a parent.
 void setParents(Collection newParents)
          Changes the set of parents.
 
Methods inherited from class org.eidola.kernel.Capsule
addMember, addPrivate, addPublic, findMember, findPrivate, findPublic, getPrivate, getPublic, removeMember, removePrivate, removePublic, setMembers, setPrivate, setPublic
 
Methods inherited from class org.eidola.kernel.NamedElement
broadcastEvent, getName, getSignatureVersion, setName
 
Methods inherited from class org.eidola.kernel.Element
getFullName, getIndirectOwners, getNamespace, getOwner, handleOwnerEvent, setOwner, toString
 
Methods inherited from class org.eidola.kernel.Container
compile, finalize, getCompilation, getCompileVersion, getStructureVersion, handleSelfEvent
 
Methods inherited from class org.eidola.kernel.event.EventBroadcaster
addListener, removeListener, updateBroadcasters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARENTS

public static final ContainerPart PARENTS
Part of an element.
See Also:
StructureChanged
Constructor Detail

Class

public Class()
Creates a new empty class.
Method Detail

getParents

public Set getParents()
Returns the set of parents, the generalizations this class explicitly declares.
See Also:
Class.Compilation.getGeneralizations()

setParents

public void setParents(Collection newParents)
                throws IllegalElementType
Changes the set of parents.

Events: StructureChanged

Parameters:
newParents - A collection of Classes which will be the new parents. This method makes in internal copy of this collection, so it is safe to pass a collection and subsequently modify it.

addParent

public void addParent(Class parent)
               throws IllegalElementType
Adds a parent.

Events: StructureChanged

Parameters:
parent - The class to add.

removeParent

public void removeParent(Class parent)
Removes a parent.

Events: StructureChanged

Parameters:
parent - The class to remove.

handleContentEvent

public void handleContentEvent(ContainerEvent event)
Handles an event passed on from a member. This handler passes SignatureChanged events up the chain of public members, and calls Container.handleContentEvent(ContainerEvent).
Overrides:
handleContentEvent in class Container

handleParentEvent

public void handleParentEvent(ContainerEvent event)
Handles an event passed on from a parent. This handler broadcasts a CompileRequired event when it receives a SignatureChanged event from a parent.

makeNewCompilation

protected Container.Compilation makeNewCompilation()
Description copied from class: Container
Creates a new Container.Compilation of an appropriate type for this container. This method only exists because Java does not use runtime types to resolve inner class names; in other words, there are no virtual inner classes. Under normal circumstances, you will not need to call this method directly; use Container.compile() instead. It is a good idea to synchronize on the container when calling this method.
Overrides:
makeNewCompilation in class Container

dump

public void dump(int i)
Description copied from class: Container
Does a debug dump of this container to System.out.
Overrides:
dump in class Container

Eidola home