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: Wed, 14 Mar 2001 18:28:28 +0100

Hi,

I encountered two ways in which to make probes. One is to make an
EmptyProbeMapImpl and add probes on demand:

    EmptyProbeMapImpl probeMap = new EmptyProbeMapImpl(aZone, getClass());

    probeMap.addProbe(getProbeForVariable("displayFrequency"));
    probeMap.addProbe(getProbeForVariable("zoomFactor"));
    probeMap.addProbe(getProbeForVariable("simulatedTime"));

    Globals.env.probeLibrary.setProbeMap$For(probeMap,getClass());

The other way is to extend EmptyProbeMapImpl and add elements as is done in
jheatbugs:

    class HeatbugObserverProbeMap extends EmptyProbeMapImpl {
      private VarProbe probeVariable (String name) {
        return
          Globals.env.probeLibrary.getProbeForVariable$inClass
          (name, HeatbugObserverSwarm.this.getClass ());
      }
      private MessageProbe probeMessage (String name) {
        return
          Globals.env.probeLibrary.getProbeForMessage$inClass
          (name, HeatbugObserverSwarm.this.getClass ());
      }
      private void addVar (String name) {
        addProbe (probeVariable (name));
      }
      private void addMessage (String name) {
        addProbe (probeMessage (name));
      }
      public HeatbugObserverProbeMap (Zone _aZone, Class aClass) {
        super (_aZone, aClass);
        addVar ("displayFrequency");
        addMessage ("graphBug:");
      }
    }

The latter seems a lot more complex to do. Is there any principled
difference?
Below are some further questions on a previous message.

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Marcus G. Daniels
> Sent: Friday, March 09, 2001 4:57 PM
> To: address@hidden
> Subject: Re: Probes


> If you just want to save a single field of an object with a probe,
> then you can make a "value = messageProbe.doubleDynamicCallOn
> (target);" call where you get messageProbe from a
> "probeMap.getProbeForMessage (messageName);".  You'll have to save
> `value' using Java file interfaces, or some ad-hoc way.
>

Just as in one of my previous questions I just want to have access to the
data of one agent. As recommended I used

Globals.env.createProbeDisplay (obj);

to create a probe for the specific object (the agent). I actually don't know
if this probe is connected to a ProbeMap (I didn't figure it out yet), so I
don't know where I should obtain the probeMap from that is needed to call
probeMap.getProbeForMessage (messageName). Maybe this can be clarified as
well. In general, the class ProbeDisplay is used to display ProbeMaps, but
in this case, to display the probemap of the agent I used a special
makeProbeAtX$Y message to a Object2dDisplay. Where is the probeMap of this
object?

Thanks,
Fred Wan.


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