Class TestInstantiableNamedObj

    • Method Detail

      • getChildren

        public java.util.List getChildren()
        Description copied from interface: Instantiable
        Return a list of weak references to instances of Instantiable that are children of this object. An implementor of this method may return null or an empty list to indicate that there are no children.
        Specified by:
        getChildren in interface Instantiable
        Returns:
        An unmodifiable list of instances of java.lang.ref.WeakReference that refer to instances of Instantiable or null if this object has no children.
      • getParent

        public Instantiable getParent()
        Description copied from interface: Instantiable
        Return the parent of this object, or null if there is none.
        Specified by:
        getParent in interface Instantiable
        Returns:
        The parent of this object, or null if there is none.
      • instantiate

        public Instantiable instantiate​(NamedObj container,
                                        java.lang.String name)
                                 throws java.lang.CloneNotSupportedException,
                                        IllegalActionException,
                                        NameDuplicationException
        Description copied from interface: Instantiable
        Create an instance by (deeply) cloning this object and then adjusting the parent-child relationships between the clone and its parent. Specifically, the clone defers its definition to this object, which becomes its "parent." The "child" inherits all the objects contained by this object. If this object is a composite, then this method must adjust any parent-child relationships that are entirely contained within the child. That is, for any parent-child relationship that is entirely contained within this object (i.e., both the parent and the child are deeply contained by this object), a corresponding parent-child relationship is created within the clone such that both the parent and the child are entirely contained within the clone.

        The new object is not a class definition by default (it is an "instance" rather than a "class"). That is, Instantiable.isClassDefinition() returns false.

        Specified by:
        instantiate in interface Instantiable
        Parameters:
        container - The container for the instance, or null to instantiate it at the top level.
        name - The name for the instance.
        Returns:
        A new instance that is a clone of this object with adjusted deferral relationships.
        Throws:
        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.
      • isClassDefinition

        public boolean isClassDefinition()
        Description copied from interface: Instantiable
        Return true if this object is a class definition, which means that it can be instantiated.
        Specified by:
        isClassDefinition in interface Instantiable
        Returns:
        True if this object is a class definition.