swarm-support
[Top][All Lists]
Advanced

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

Re: Combining an autorepeat schedule and a autodrop schedule


From: Paul E Johnson
Subject: Re: Combining an autorepeat schedule and a autodrop schedule
Date: Fri, 06 Oct 2000 11:15:39 -0500

address@hidden wrote:
> 
> In my model I want to combine two kind of schedules. One schedule is used to
> repeat actions (in my case every "month"), the other is used for action that
> take place only once (in my case birth and death). I create both schedules
> in one swarm and activate them using this swarm as context.
> 
> If i use two repeating schedules with autodrop turned on for one of these
> schedules:
> everything works fine until the autodrop schedule starts to repeat itself.
> No error is given but new actions from the autodrop schedule are no longer
> activated.
> 
> If i use one repeating schedule and one nonrepeating autodrop schedule:
> nothing happens until the following error is produced:
> 
> *** event raised for error: InvalidOperation
> *** function: _update_mergeSchedules(), file:
> /src/Swarm/swarm/src/activity/Sc
> dule.m, line: 268
> > MergeSchedule is invalid. There is no*** execution terminating due to
> error
> /src/Swarm/swarm/src/defobj/Symbol.m:173 -[Error(c) _raiseEvent:]
>       0 [sig] LEMRA 1813 stackdump: Dumping stack trace to
> LEMRA.EXE.stackdump
> 
> So my questions are:
> - Can I activate two schedules (of which one autodrop) in one swarm, and, if
> not, how can I do it in another way?
YEs, no problem.
> - Is it possible to use a repeating autodrop schedule? (In my case
> representing a year, allowing me to plan an event in terms of the month and
> week of the next year)
If you want something to happen one time, do not create it as a
repeating schedule. Just create the schedule, and have it execute a one
time action.

Autodrop is mainly used for dynamic schedules, ones where you write
methods that dump actions into the schedule and you want those executed
actions removed from the schedule after they have run.

Here is one way I schedule a thing to happen one time. I create the
schedule object like so:

- buildActions
{
  [super buildActions];
  schedule= [Schedule createBegin: self];
  [schedule setAutoDrop: 1];
  schedule = [schedule createEnd];
  [schedule at: 0 createActionTo: self message: M(step)];
  return self;
}

And there is a method that can put an action into that schedule.
- scheduleInteractionTime: (int) x
{
  [schedule at: x createActionTo: self message: M(interact)];
  return self;
} 

Note in the buildActions method, i've got a one-time call to the step
method, and if you want, that is all you need to get a one time action
to go.  Note there is no repeat interval set.

This is a convenient structure because you can write the step method so
that additional actions can be scheduled.  Suppose the step method
triggers a future action, such as "scheduleInteractionTime:" above, and
it can also schedule another step at a future time, if want.

[self scheduleInteractionTime: 5];
 
[schedule at: 23 createActionTo: self message: M(step)];


This setup is more complicated than you need, possibly, but it is a
handy design.

The other schedules you create will go on.


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