swarm-support
[Top][All Lists]
Advanced

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

Re: Time


From: gepr
Subject: Re: Time
Date: Mon, 13 Jan 2003 07:01:36 -0800

Li An writes:
 > In a Java Swarm modeling, suppose I have a simulation of 15 years. If I 
 > want to report something (say, age of a person, person[1]) at a certain 
 > year  (year j), should I use Globals.env.getCurrentTime() to represent that 
 > time?
 > 
 > For instance, in regular Java code, it should look like this:
 > ...
 > for (int j=0;j<endTime;j++) {
 > ...
 > d=(Person)personList.get(1);//want to take out the second person in the list
 > System.out.println("At year "+(j+1)+"person 1's age is "+d.getAge());
 > ...
 > }
 >   Should we use Globals.env.getCurrentTime() to replace j in above print 
 > command? In a Swarm /Java code for the same job, do we not usually use the 
 > for loop to control time? Instead, we let the schedule to control the time 
 > by using something like "modelSchedule.at$createAction(0,modelActions)"?

getCurrentTime() will return the time relative to the master 
schedule.  So, if each cycle of the top level swarm consists
of 1 year, then yes.  You should use that.

-- 
glen e. p. ropella              =><=                           Hail Eris!
H: 831.335.4950                              http://www.ropella.net/~gepr
M: 831.247.7901                               http://www.tempusdictum.com


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