swarm-support
[Top][All Lists]
Advanced

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

String problems when using EZBin in javaswarm


From: xiaomei liu
Subject: String problems when using EZBin in javaswarm
Date: Wed, 10 Apr 2002 23:11:59 -0800

Hello,
 
From your mail in the archive, I learned how to implement Histogram by using EZBin. Thank you.
 
But it seems that the setTitle and other methods, which are related to String parameters, do not work. I am using javaswarm2.1.1 under windows 2000.
 
I noticed that you mentioned there are problems when using String in class EZBin, and you suggested download updated DLLs and a new swarm.jar from: ftp://ftp.swarm.org/pub/swarm/binaries/w32/2.1.1-fixes. I tried. But it seemed that the address is not correct. I am wondering if it is moved to somewhere else? I attached your previous e-mail for reference.
 
Thank you very much.
 
Best Regards,
Xiaomei Liu

Subject: Re: Java EZBin Implementation
From: Marcus G. Daniels (address@hidden)
Date: Tue May 09 2000 - 18:29:38 MDT


>>>>> "MS" == Michele Sonnessa <address@hidden> writes:

MS> I would like to ask if it is possible in JavaSwarm to use
MS> the class EZBin to make an Histogram.

Below is an example of how this can be done.

In Java, there is a clear distinction between creating and using
phases: they are different classes. So a trickier part is connecting the
phases together. You do that with the
 
  new EZBinCImpl (new EZBinImp ())

_expression_. The rest is like Objective C. (When there are
using-phase constructors like in EZGraph, it's easier since the phase
switch is hidden.)

Oh, I noticed there's a problem with the use of string setters in this
class, so you may want to get updated DLLs and a new swarm.jar from:

  ftp://ftp.swarm.org/pub/swarm/binaries/w32/2.1.1-fixes

import swarm.Globals;
import swarm.analysis.EZBinC;
import swarm.analysis.EZBin;
import swarm.analysis.EZBinCImpl;
import swarm.analysis.EZBinImpl;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.defobj.Zone;
import swarm.collections.List;
import swarm.collections.ListImpl;
import swarm.Selector;

public class EZBinDemo extends GUISwarmImpl {
  class Agent {
    double value;

    Agent (double value) {
      this.value = value;
    }
    public double getAgentValue () {
      return value;
    }
  }

  EZBin ezBin;
  List list;

  EZBinDemo (Zone aZone) {
    super (aZone);

    list = new ListImpl (aZone);

    for (int i = 0; i < 200; i++)
      list.addLast (new Agent (Math.log (i)));

    EZBinC ezBinC;
    ezBinC = new EZBinCImpl (new EZBinImpl ());
    ezBinC.createBegin (aZone);
    ezBinC.setBinCount (10);
    ezBinC.setLowerBound (0);
    ezBinC.setUpperBound (5);
    ezBinC.setCollection (list);
    ezBinC.setTitle ("My EZBin");
    ezBinC.setAxisLabelsX$Y ("count of log (i)", "i");
    try {
      ezBinC.setProbedSelector (new Selector (Agent.class,
                                              "getAgentValue",
                                              false));
    } catch (Exception e) {
      e.printStackTrace (System.err);
      System.exit (1);
    }
    ezBin = (EZBin) ezBinC.createEnd ();
  }

  void show () {
    ezBin.update ();
    ezBin.output ();
  }

  static public void main (String args[]) {
    Globals.env.initSwarm ("EZBinDemo", "0.0", "address@hidden", args);
    
    EZBinDemo ezBinDemo = new EZBinDemo (Globals.env.globalZone);
    ezBinDemo.show ();
    ezBinDemo.buildObjects ();
    ezBinDemo.buildActions ();
    ezBinDemo.activateIn (null);
    ezBinDemo.go ();
  }
}


reply via email to

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