swarm-support
[Top][All Lists]
Advanced

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

Re: makeProbeAtX$Y - Can I create a custom probe map for an object?


From: Paul Johnson
Subject: Re: makeProbeAtX$Y - Can I create a custom probe map for an object?
Date: Fri, 07 Jun 2002 09:14:33 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020516

Ah, I see. Perhaps one of the old timers can tell us what their
intention was in writing makeProbeAtX: Y: .

If you were writing a model in ObjC, here is what you would do. Create a
subclass of the space class you are using, then override just that
makeProbeAtX:Y: method, so you could customize the probe.

I don't do much Java in the past 8 months and can't remember if there is
a reason you could not do that in java. When I was working pretty hard
on a java model, about in February, 2001, I recall thinking we needed a
subclassing guide for Swarm Java users and in the context of subclassing
from Swarm's Arguments class, Marcus Daniels wrote some emails about the
way to deal with Swarm classes that require funny business between
createBegin and createEnd.  I think you can find it in the email list
and I have the sample program here:

http://lark.cc.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/java/ArgumentsSubclass.java

http://lark.cc.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/java/ArgumentsSubclass2.java

I think the email list is still searchable, you could try that route too.

I see why you wonder about learning more on the jni. I did save this
helpful message from MGD:

http://lark.cc.ku.edu/~pauljohn/SwarmFaq/Memos/JavaNamingInSwarmLibs.txt

Geoff Wright wrote:
> Hi Paul, 
> 
> Thanks for the link to the source code. I will be interested in learning more 
> about JNI (when time permits..).
> 
> As for the Probes...
> I looked at both jheatbugs and heatbugs from swarmapps but I am still missing 
> something important.
> 
> In jheatbugs, you create a HeatbugObserverProbeMap and add variables and 
> messages to it with the addVar() and addMessage() methods.  
> HeatbugModelProbeMap is also created and customizable with the addVar() and 
> addMessage() methods.
> 
> I can see that both of these ProbeMaps are customizable. However, there is a 
> third ProbeMap that is created with a "makeProbeAtX$Y" method operating on an 
> Object2dDisplay object.  That is, when you click on a bug in the raster 
> display, you get a ProbeMap for that object.  I am not able to see if/how 
> this ProbeMap can be customized.  It seems to me that all of the probed 
> object's public members are put on the probe.  
> 
> The code that introduces this functionality into the model is:
> 
>     // Also, tell the world raster to send mouse clicks to the
>     // heatbugDisplay this allows the user to right-click on the
>     // display to probe the bugs.
>     try {
>       worldRaster.setButton$Client$Message 
>         (3, heatbugDisplay, new Selector (heatbugDisplay.getClass (), 
>                                           "makeProbeAtX$Y", true));
>     } catch (Exception e) {
>       System.err.println ("Exception makeProbeAtX$Y: " 
>                           + e.getMessage ());
>     }
> 
> Perhaps I am thinking about this the wrong way but it seems to me that I 
> would 
> have to get into the Objective C code to figure out what's going on with this 
> ..
> 
>>From Object2dDisplay.m:120
> // code to make a probe for an object at a specific point. This is
> // good to make as a button client for Raster widgets
> - makeProbeAtX: (unsigned)x Y: (unsigned)y
> 
> and then,
> 
>>From simtoolsgui.h:271
> //#: This macro creates a probe display for the given object
> #define CREATE_PROBE_DISPLAY(anObject) \
>   _createProbeDisplay(anObject)
> 
> So, it seems to me that I will have to get into the ObjectiveC code to figure 
> out what's going on with the ProbeMap created with the "makeProbeAt" method.
> Is my intuition right here or is there easier fix that I am overlooking?
> 
> Thanks again,
> geoff



-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700


                  ==================================
   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]