The Lisp-Stat Linking Protocol

March 22, 1996

Linking is a protocol for communicating between active graphs (objects that inherit from graph-proto). Most of the protocol is public and can be customized. Part of it is currently private. Originaly this was primarily for efficiency reasons.

There are two aspect of the protocol:

• Determining which plots are linked

• Propagating changes to point states between plots

Let’s look at these in turn.

Determining which Plots Are Linked

Determining who is linked is handled by two messages, :linked and :links.

:linked     (send p :linked) returns T if p is linked, NIL if not.
         (send p :linked t) links p.
         (send p :linked nil) unlinks p.

This method must set an internal flag indicating whether a plot is linked, so an override

     must use call-next-method.

:links (send p :links) returns NIL if p is not linked. If p is linked, it should return a list of all plots linked to p. The list may, but need not, include p.

Any implementation of these two methods that satisfies this description will work. The :linked method is used by the standard menu item for turning linking on and off.

Propagating Changes to Point States

This is the more complicated part. There are several ways to make changes to point states that need to be propagated. You can use the mouse, certain menu items, or the :pointstate message to change the state of one or more poins. (The :point-state message is a programatic way of accomplishing a state change that should be propagated to all linked plots. It is not a low-level mechanism for adjusting the internal states of points in individual plots.) When point states are changed in a plot p the state propagation process does the following:

Finds the list of plots linked to p with the :links message

For each point with index i changed in a single operation

For each linked plot q where the current point state of point i does not match the new state

(a) Adjusts the internal state of point i in plot q and records the previous state. (The mechanism is undocumented. It happens to currently use knowledge of the implementation of the internal state when a graph is active. This is mostly for efficiency reasons that are no longer as important as they once were. It could now be done using an internal message, maybe called something like

            lisp-stat::adjust-internal-point-state. Insuring that linking is only

applied to children of graph-proto that are active makes sure this will work – the set of objects to which linking is applicable is part of the protocol.)

(b) Sends q the :adjust-screen-point message with argument i. This allows plot q to redraw the point.

Sends each linked plot the :adjust-screen message.

You can customize the linking process by redefining the :adjust-screen-point or :adjust-screen methods. Changing the :adjust-screen-point method gives finer control and may provide a better visual effect by allowing changes to flow through all all plots simultaneously. But performance can be aproblem if each change is of significant size. Changing :adjust-screen is usually simpler and adequate for most purposes. It can have less desirable visual results

– changing one plot at a time can produce a distracting wave artifact that jumps from one plot to another.

talk about :needs-adjusting

There are two places at wich you can modify the linking process: at the individual point level

Do smoother example

rework steve’s example?

redo alternate linking