In the circle example introduced in Evaluation of Interobject Relationships, the application could represent the X and Y coordinate values of the grip as nodes in a graph (Gx and Gy). The width parameter might be represented by two nodes for the endpoints (W0 and W1). Finally, the scale action (S) might be represented by a single node. The resulting graph resembles the following figure:
The application of DAGs and the evaluation classes is not limited to dynamic blocks. The following figure shows how to apply a graph to the evaluation of a mathematical expression. The binary operation nodes depend on value nodes or other binary operator nodes. Evaluating a binary operator node performs the indicated operation on the values of the preceding nodes, and returns the computed value. Thus a and b are multiplied by the multiplication (*) binary operator node, 3 is subtracted from this product by the subtraction (-) binary operator, and the result of this subtraction is divided by 7 to produce the final result x.
In the following figure, connectable nodes represent the authoring elements of a dynamic block instance. Each node can provide and accept connections based on connectable properties. When a node finds another node that exposes a desired connectable property, a connection can be made. Any number of nodes can connect to a single connectable node.
A grip element (G) appears in the top bubble of the figure. Gx and Gy are connectable properties of G that track the movement of the grip in the XY plane. The width parameter (W), represented by the middle bubble, provides connections W0 and W1, which maintain previous and current values of the width parameter. When W is evaluated, an expression calculates the change in width and exposes the result as a connectable property. A scale action (S), in the bottom bubble, supplies Sx and Sy connectable properties that represent X and Y scale factors.
When the grip moves, its Gx and Gy values are updated. The width parameter (W) needs only an X value and queries G for the Gx property. When this property is confirmed, the W1 property connects to Gx. When Gx is evaluated, W1 is updated. A percentage of the change in width is then calculated by subtracting the original X value (W0) from W1 and dividing the difference by the original width. This percentage is exposed as the W connectable property.
To uniformly scale the circle, the X and Y scale factors must be equivalent. Therefore, the scale action component (S) connects both the Sx and Sy properties to the W connectable property. Evaluation of W results in the scale action S. The Sx and Sy scale properties combine to execute the scale action, based on the movement of the grip and the resulting change in width.