swarm-support
[Top][All Lists]
Advanced

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

Re: using getObjectAtX$Y with a createFActionForEachHeterogeneous$call


From: pauljohn
Subject: Re: using getObjectAtX$Y with a createFActionForEachHeterogeneous$call
Date: Thu, 05 Jul 2001 07:11:14 -0500

If I were you, I would try to separate the two problems--the getting of
the object and the scheduling.  For the first try, why not use the
older, more simple scheduling method "createActionForEach", no FCall, no
Heterogeneous or Homogeneous?

The other possibility, which is becoming my standard approach when there
are complications, is to write a method in the model swarm that loops
through the list doing something, and then put that in the schedule. 
Here is an example:

Use this in buildActions
        try{
          modelSchedule.at$createActionTo$message(0,this, new
Selector(getClass(
), "stepAgents",false));
          } catch (Exception e) {
           e.printStackTrace (System.err);
            System.exit (1);
        }

 

public Object stepAgents () {
    Iterator index;
    
    index = recruiterList.iterator();
    while ( index.hasNext()){
      Recruiter aRecruiter = (Recruiter) index.next();
   
      aRecruiter.updateMembershipLevel();
      aRecruiter.makeProposal();
      aRecruiter.doRecruiting();
      System.out.println("ModelSwarm stepAgents");
     
    }

Isis GIRALDO wrote:
> 
> Hi there,
> 
> I have been trying to use the createFActionForEachHeterogeneous$call to
> avoid my list to be frozen when it is created. At some point I need to
> get some objects from the world. To get this I use the getObjectAtX$Y
> method. 


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