public interface Instantiable extends Derivable
An object that implements this interface can be in one of two states.
Either it is a class definition (
isClassDefinition() returns true)
or it is not. Only objects that are class definitions can be instantiated.
Instantiation is done via the
method. If an object
is instantiated from this object, then the new object is called the "child"
and this object is called the "parent." An instance of Instantiable can have
at most one parent (returned by the
getParent() method), but it
can have many children (returned by the
An object may be both a child and a parent.
A child is required to be a deep clone of its parent. That is, every object deeply contained by the parent must have a corresponding object deeply contained by the child. The object that is deeply contained by the parent is called the "prototype" and the object deeply contained by the child is called the "derived" object. A derived object has the same name relative to the child as the prototype has relative to the parent. Moreover, a derived object is an instance of the same Java class as the prototype.
This correspondence between a parent and child is called the "derivation invariant." Any correct implementation of this interface must ensure that the derivation invariant is always satisfied, even if the parent changes after the child was instantiated. If new objects are added to the parent, then derived objects must be added to the child.
|Modifier and Type||Method and Description|
Return a list of weak references to instances of Instantiable that are children of this object.
Return the parent of this object, or null if there is none.
Create an instance by (deeply) cloning this object and then adjusting the parent-child relationships between the clone and its parent.
Return true if this object is a class definition, which means that it can be instantiated.
getDerivedLevel, getDerivedList, getPrototypeList, propagateExistence, propagateValue
Instantiable instantiate(NamedObj container, java.lang.String name) throws java.lang.CloneNotSupportedException, IllegalActionException, NameDuplicationException
The new object is not a class definition by default (it is an
"instance" rather than a "class"). That is,
container- The container for the instance, or null to instantiate it at the top level.
name- The name for the instance.
java.lang.CloneNotSupportedException- If this object cannot be cloned.
IllegalActionException- If this object is not a class definition or the proposed container is not acceptable.
NameDuplicationException- If the name collides with an object already in the container.