swarm-support
[Top][All Lists]
Advanced

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

Re: Display problem


From: Paul E. Johnson
Subject: Re: Display problem
Date: Wed, 10 May 2000 18:45:34 -0500

I have an example that does this. In 

In the middle of buildObjects, I have this:

  stabilityGraph = [EZGraph createBegin: [self getZone]];
  SET_WINDOW_GEOMETRY_RECORD_NAME (stabilityGraph);
  [stabilityGraph setTitle: "Membership"];
  [stabilityGraph setAxisLabelsX: "time" Y: "Total Membership"];
  stabilityGraph = [stabilityGraph createEnd];




-createMembershipSequence: (id) aRecruiter
{
  id sequence;
  char sequenceName[10];
  sprintf(sequenceName,"Org. %d",[aRecruiter getGrpNumber]);
  sequence= [stabilityGraph createSequence: sequenceName
                            withFeedFrom: aRecruiter
                            andSelector: M(getMembershipLevel)];
  return sequence;
}

-dropMembershipSequence: (id) aRecruiter
{
  [stabilityGraph dropSequence:  aRecruiter];
  return self;
}


In ModelSwarm.m, when agents are created, the method doing the creating
tells the observer to create a sequence and return a pointer to it, that
way when they die they can tell the graph to remove that sequence. When
they are created, that method in modelswarm does this:

   [recruiter setMembershipSequence:
               [observerSwarm createMembershipSequence: recruiter]];

When they die, they do this:
   [observerSwarm dropMembershipSequence: [agent
getMembershipSequence]];



And within the Agent, all they need is set and get methods for the
sequence, as in:>
-setMembershipSequence: (id) aSeq
{
  memSequence=aSeq ;
  return self;
}

-getMembershipSequence
{
  return memSequence;
}


This design is required because agents are killed and born.


"Marcus G. Daniels" wrote:
> 
> >>>>> "SM" == sabeeha  <address@hidden> writes:
> 
> SM> for(i=0;i<n;i++){
> SM>    sprintf(name,"IdeaC%d",i);
> SM>     [agentGraph4 createSequence: name
> SM>              withFeedFrom: mSwarm
> SM>                        andSelector: M(getTargetNumberOfTimesInStock)];
> SM> }
> 
> SM> so by the above code , i create n sequences, but i am not able to
> SM> get correct values in the graph.  my
> SM> "getTargetNumberOfTimesInStock" function returns correct values,
> SM> but my EZgraph cannot plot it right(plots erroneous values).
> 
> getTargetNumberOfTimesInStock will need to return `double'.
> Also, you'll need some way to discriminate values per `i'...
> 
>                   ==================================
>    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.

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