swarm-support
[Top][All Lists]
Advanced

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

RE: Probes


From: Fred Wan
Subject: RE: Probes
Date: Fri, 16 Mar 2001 12:18:32 +0100

Hi, the reason I didn't provide the complete source is that it is working
fine, except the bug colour change, which I'll probably figure out how to do
myself. My question was about whether to use MessageProbes to write data
about the behaviour of bugs to file or to do it by calling the bugs
accessors directely and scheduling them as a regular activity. In other
words, how much overhead is created by doing it through MessageProbes, and
are there any advantages using them instead of the coarse way of just
calling the accessors of the bugs and writing their data to file.

Concerning the bug-colouring routines... There's a line of code in jheatbugs
(HeatBugObserverSwarm line 216) that I don't understand:

heatDisplay.setDisplayMappingM$C (512, 0); // turn [0,32768) -> [0,64)

I looked it up in the ref guide, but couldn't find out what it does. Any
clarification will be appreciated.

Thanks,
Fred Wan.


    // Now create a Value2dDisplay: this is a special object that
    // will display arbitrary 2d value arrays on a given Raster
    // widget.
    heatDisplay = new Value2dDisplayImpl
      (getZone (), worldRaster, colormap, heatbugModelSwarm.getHeat ());

    heatDisplay.setDisplayMappingM$C (512, 0); // turn [0,32768) -> [0,64)

    // And also create an Object2dDisplay: this object draws
    // heatbugs on the worldRaster widget for us, and also
    // receives probes.

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Marcus G. Daniels
> Sent: Thursday, March 15, 2001 7:29 PM
> To: address@hidden
> Subject: Re: Probes
>
>
> >>>>> "FW" == Fred Wan <address@hidden> writes:
>
> FW> The code fragment belows shows how a bugList is traversed to pick
> FW> a bug (i.c., Bug #1), how it is tried to change its colour
> FW> (doesn't work) and how MesageProbe is retrieved (with
> FW> getProbeForMessage, which is a method of a SwarmObject!)  to print
> FW> out the X-position of the bug.
>
> MessageProbes are working for me.  (See example below.)
>
> If you think there is a bug somehow, you'll need to write an example I
> can compile and run, not a `blurb' with undefined degrees of
> freedom...
>
> import swarm.Globals;
> import swarm.objectbase.SwarmObjectImpl;
> import swarm.objectbase.MessageProbe;
> import swarm.defobj.Zone;
>
> public class TestMessageProbe extends SwarmObjectImpl {
>
>     public double getXPos ()
>     {
>         return 2.5;
>     }
>
>     static void main (String args[]) {
>         Globals.env.initSwarm ("TestMessageProbe", "address@hidden",
>                                "0.0",  args);
>         TestMessageProbe testMessageProbe =
>             new TestMessageProbe (Globals.env.globalZone);
>         testMessageProbe.test ();
>     }
>
>     TestMessageProbe (Zone aZone) {
>         super (aZone);
>     }
>
>     void test () {
>         MessageProbe messageProbe = getProbeForMessage ("getXPos");
>
>         System.out.println (messageProbe.doubleDynamicCallOn (this));
>     }
>
> }
>
>                   ==================================
>    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.
>


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