swarm-support
[Top][All Lists]
Advanced

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

Re: [Q] Display schedule vs. model schedule


From: Benedikt Stefansson
Subject: Re: [Q] Display schedule vs. model schedule
Date: Tue, 06 Jul 1999 12:21:24 +0200

Gary Polhill wrote:
> 
> When you do:
> 
>   displaySchedule = [Schedule createBegin: self];
>   [displaySchedule setRepeatInterval: 1];
>   displaySchedule = [displaySchedule createEnd];
>   [displaySchedule at: 0 createAction: displayActions];
> 
> and:
> 
>   modelSchedule = [Schedule createBegin: self];
>   [modelSchedule setRepeatInterval: 1];
>   modelSchedule = [modelSchedule createEnd];
>   [modelSchedule at: 0 createAction: modelActions];
> 
> How do you know when the display will occur in relation to the model
> schedule? Should you assume that the display will happen after the
> model events, or should you make no assumption at all about when the
> display will happen? (Could it even happen in the middle of the
> modelActions?)
> 
The order of invocation is determined by the order in which you activate
the schedules. 

In your simple example, where the repeat interval is the same for both
schedules, if you activate modelSchedule first and displaySchedule
second all the actions in modelActions will be executed in the order
they were defined and then all the actions in displayActions in the
order they were defined. 

This is completely deterministic. It doesn't matter in which order you
define the actiongroups and schedules, the order in the activation phase
is all that matters. 

This can of course get slightly more complicated when you deal with
different repeat intervals, or if you have schedules activate schedules
(e.g. you want an event to take place for the first time in period 21
and repeat only three times etc.) In this case the burden is on the
programmer to think through in which order the actions/events will be
merged into the underlying activity, although it is usually obvious.
Just keep in mind that activities, schedules and groups are simply
glorified ordered lists (sets). 

You can play around with the example code in the scheduledemo here to
get a feel for scheduling (with some naive visual feedback):

ftp://ftp.santafe.edu/pub/swarm/users-contrib/anarchy/swarmfest99-demos.tar.gz


-Benedikt

-----
Present coordinates: 
Dep. of Economics, Univ. of Trento, Via Inama 1, 38100 Trento, ITALY
Off: +39 0461 882246/267875 Mob: +39 347 0415721 Fax: +39 0461 882222

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