public interface Derivable extends Nameable
The prototype and its derived objects are instances of the same Java class, and by default, if they have a "value," then they have the same value. The derived object may, however, "override" its value. Propagation of changes in the value from the prototype to the derived objects that do not override the value is handled by the propagateValue() method. It is up to that method to properly handle shadowing that might occur if a derived object that is overridden is also a prototype for other derived objects.
A derived object arises from a parent-child relationship, which is supported by the subinterface Instantiable. Every object that is (deeply) contained by a parent has a corresponding derived object that is (deeply) contained by the child. Thus, the existence of the derived object is "implied" by the parent-child relationship. The depth of a derived object relative to this parent-child relationship is returned by the getDerivedLevel() method. For example, if the container of a derived object is the child of the container of its prototype, then getDerivedLevel() will return 1.
The derived level returned by getDerivedLevel() affects whether a derived object is explicitly mentioned when a model is exported to MoML. Normally, a derived object is not mentioned in the MoML since its existence is "implied" by the existence of the prototype and the parent-child relationship. However, since it is possible to export MoML for any object in a hierarchical model, the exported MoML may not include the parent-child relationship, since it might be below it in the hierarchy. In this case, the derived object will be described in the exported MoML, since it is not implied in the exported MoML.
The getDerivedList() method returns a list of all the objects that are derived from a prototype. The getPrototypeList() method returns a list of all prototypes from which this object is derived.
Instantiable
,
NamedObj
Modifier and Type | Method and Description |
---|---|
int |
getDerivedLevel()
Get the minimum level above this object in the hierarchy where a
parent-child relationship implies the existence of this object.
|
java.util.List |
getDerivedList()
Return a list of objects derived from this one.
|
java.util.List |
getPrototypeList()
Return a list of prototypes for this object.
|
java.util.List |
propagateExistence()
Propagate the existence of this object.
|
java.util.List |
propagateValue()
Propagate the value (if any) held by this
object to derived objects that have not been overridden.
|
description, getContainer, getDisplayName, getFullName, getName, getName, setName
int getDerivedLevel()
java.util.List getDerivedList()
Implementors of this method may return an empty list, but should not return null. This method should return a complete list, including objects that have been overridden. All objects in the returned list are required to be of the same class as the object on which this method is called (they should be clones constructed directly or indirectly, via another clone).
java.util.List getPrototypeList() throws IllegalActionException
IllegalActionException
- If a prototype with the right
name but the wrong class is found.java.util.List propagateExistence() throws IllegalActionException
IllegalActionException
- If the object cannot be created.java.util.List propagateValue() throws IllegalActionException
IllegalActionException
- If propagation is not possible.