swarm-support
[Top][All Lists]
Advanced

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

ptplot and swarm-java


From: Paul E Johnson
Subject: ptplot and swarm-java
Date: Thu, 28 Dec 2000 12:24:35 -0600

I wrote my first Swarm in java this weekend.  It is an adaption of an El
Farol model that was prepared in objective C. I'll share when I get the
kinks worked out, so people can compare java and obj-c models side by
side.  

I think java has much to recommend it as a language, and this experience
has been pretty nice.  I'm stuck on a problem, however, in creating a
plot. I have the ptplot-3.1 package, and I'm able to build a bar chart
using the Plot class.  I used the example of the jipd source code,
making a few "nips and tucks".  I can give you the source code if it
helps you to understand these 2 problems I have.  

1.  When I press "quit" in Swarm, the model freezes, and won't go away. 
I have to ctrl-c in the xterminal to get swarm to die.  I know this is
happening because the ptplot is sitting open.  It does not happen with
jipd, but I don't see what I'm missing.  I don't see anything like
enableDestroyNotification or such.

2.  This is a specific ptplot question, maybe I have to go bother their
email list about it.  But since we're friends....

In my plot, I turn on the bars in the constructor and at each time
timestep, the observer's update action calls a method in the plot class
in which the hashmap is processed and the bars are drawn.  I am not able
to figure a way to "erase" the bars between timesteps, so the bars just
accumulate on the screen, piling on top of one another.  I've tried the
clear() method before looping through the addPoints() method, but it
makes the bars just disappear and never show up.

If there are other users who have java apps with ptplot applications, I
think you could help us all by sharing.  The jipd model is a big help. 
A set of standard classes to get certain kinds of graphs would be a plus
for us.  jipd gives a time plot example, I will eventually have a
barChart example, and probably a histogram as well.  If we had a
standard set of names for these things, they could become effective
replacements for EZGraph/EZBin.

I'm making a bigger list of my java tidbits, will post sometime when it
seems less embarrassing.  

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.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]