swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Probing: notification of target


From: Sven N. Thommesen
Subject: Re: Probing: notification of target
Date: Fri, 23 Jan 1998 21:33:16 -0600

Thanks for everyone's comments!

Dwight Wilson wrote me privately to suggest a couple of easy ways to
achieve the desired goal:

a) give the object an 'updateData' method, with a corresponding button on
the probe, requiring users to hit the button after they're finished
altering data. [Easy solution, but it *does* rely on the user hitting that
button.]

b) let the object keep duplicate copies of all relevant data, and let it
schedule a call on itself each period to a method 'compareIVars', which
does a compare and takes any required actions. [Not too bad if we're
talking about the ModelSwarm, but kinda expensive timewise if every bug
does it.] Ken suggested this as well.

The OpenStep solution to Notifications that Chris mentions seems like
overkill for the limited purpose I have in mind -- but it might well be
useful for other (larger) simulations than mine, or for other purposes.
(The Modsim language, for example, has specialized Trigger objects which
notify a list of recipients whenever a given event occurs.)

Perhaps I can suggest a simple addition to the existing probe machinery:
add a method 

        -setNotificationMethod: (SEL) nMethod;

so that we could say something like

        floatprobe = [[probeLibrary getProbeForVariable: "randomMoveProbability"
                                inClass: [self class]]
                                setFloatFormat: ".3f"];

        [floatprobe setNotificationMethod: M(randomMoveProbabilityChanged)];

        [probeMap addProbe: floatProbe];

Then, whenever the referenced variable is changed by the probe (the user
hits Enter), not only is the data variable changed, but the specified
message is sent to the object as well. (And if no selector is set, no
message is passed.)

Then the programmer can decide whether to have a separate notification
method for each ivar, or a common one for all the ivars, or none at all.

Drone-ing on,

--Sven


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]