[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] EZGraph and sequences
From: |
Paul Johnson |
Subject: |
Re: [Swarm-Support] EZGraph and sequences |
Date: |
Wed, 05 Feb 2003 08:57:25 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020918 |
Yes, this can be done.
When a sequence is inserted, swarm returns an object you can remember
and then drop when you no longer want to plot that line. To add an
additional object to the graph, just do it! I mean, send the graph
object a command to add that object.
Here's what I mean. In my ObserverSwarm, I have an EZgraph object
"membershipGraph". I have these 2 methods
- createMembershipSequence: (id)placeholder
{
id sequence;
char sequenceName[10];
sprintf(sequenceName,"Org. %d",[placeholder getGrpNumber]);
sequence= [membershipGraph createSequence: sequenceName
withFeedFrom: placeholder
andSelector: M(getMembershipLevel)];
return sequence;
}
- dropMembershipSequence: (id)placeholder
{
[membershipGraph dropSequence: placeholder];
return self;
}
Whenever I want to add an object to the graph, that
createMembershipSequence method gets called, either from that class or
another one. This happens to be from another one, one which already
knows where the "observerSwarm" is:
id aSequence = [observerSwarm createMembershipSequence: recruiter]
and if you don't want to plot an agent anymore:
[observerSwarm dropMembershipSequence: aSequence];
It works, I'm sorry I dont have a small working example to give you, but
there is enough code for you to figger it out, I think
pj
Michael Carney wrote:
Hi all,
Just a quick question. Is it possible to create a sequence with EZGraph while
the model is running i.e. can you insert a new line on your graph at time n.
At the moment I have a graph that gets the value of an attribute at each time
step, from a List of agents. While the model runs the list occasionally gets
larger and I'd like to show the value of the attribute in the new agent that
has joined.
I'm using Swarm-2.1.1 in java.
Thanks in advance for any help,
Michael Carney
TCD, Dublin, Ireland
--
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