swarm-support
[Top][All Lists]
Advanced

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

Re: scheduling schedules after time 0.


From: Benedikt Stefansson
Subject: Re: scheduling schedules after time 0.
Date: Sat, 08 Apr 2000 16:45:09 -0600

"Paul E. Johnson" wrote:

> OK, I gotcha there.  But I still don't understand what are the
> properties of the default Schedule, i.e., what gets returned from
>
> another=[Schedule create: self];
>
> and why that thing lets you add other schedules to it whenever you
> want.
>
> If "another" has no repeatInterval set, and it does not have autoDrop
> set, then what properties does it have?  Does it repeat?  Please humor
> me here.

Remember that schedules and ActivityGroups are essentially just fancy words
for specialized collection objects. These collections contain a list of items
- instances of the Action class,  that define a target object, a method to
invoke on the target and argument(s) to pass when the method is invoked.

Because Schedules and ActivityGroups are also objects they can of course be
the target of an Action. When a Schedule sends a 'perform' message to another
Schedule or to an ActionGroup the receiver simply iterates over its members
and invokes the methods defined in each Action.

Hence, the fundamental idea behind the activity library is that a discrete
event simulation can be built from a hierarchy of instances of these classes.

For the hierarchy to perform we need an underlying processor, an object that
polls activated schedules for the events listed and triggers objects by
iterating over the list of queued actions.  This is the role of the Activity
class, which is usually instantiated with a call to the initSwarm dot dot dot
macros. Activation of Schedule instances and Swarms (as in activateIn: aSwarm
or activateIn: aSchedule) passes a reference to the schedule or swarm to
activity, which as you may have guessed is also essentially a wrapper around
a collection of actions.

It is turtles all the way down...

So repeat interval or drop has nothing to do with it - a schedule is just a
wrapper around a collection that may or may not contain members. When the
activity polls an activated but empty schedule nothing happens. You can at
any time send an atTime:createActionTo:message: message to an activated
schedule, and it will insert the reference to action,timestep on its internal
list.

Also bear in mind that to insert an action on a schedule there is no need to
create an ActionGroup - the interface for both classes allows one to insert
actions directly, as in:

[actionGroup createActionTo: target message: M(methodName) ];
[schedule atTime: 0 createActionTo: actionGroup];

or

[schedule atTime: 0 createActionTo: target message: M(methodName)];


The fundamental difference between Schedules and ActionGroups is that a
Schedule associates an action with a timestep, whereas an ActionGroup simply
lists events with no reference to time (order should also not matter,
although in the current implementation of the library actions are always
executed in the order they were defined unless the programmer specifies
random order).

Benedikt


--
Benedikt Stefansson      | address@hidden
CASA, Inc.               | Ph : (505) 988-8807 x101
Santa Fe, NM 87501       | Fax: (505) 988-3440




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