//Marcus Daniels swarm-support august 31, 1999 WS> I implemented the above -- excluding startSchedule, for the time WS> being -- and when I call it with: [self scheduleFrom: 10 To: 20 WS> Behaviour: M(breed)]; FWIW, here's how I'd do it: #import #import @interface PeriodSwarm: Swarm { id controlSchedule; id periodSchedule; id anotherSchedule; id periodActivity; } - setStartTime: (timeval_t)start; - setStopTime: (timeval_t)stop; - start; - stop; - activateIn: swarmContext; - click; - run; @end @implementation PeriodSwarm + createBegin: aZone { PeriodSwarm *obj = [super createBegin: aZone]; obj->controlSchedule = [Schedule create: aZone]; return obj; } - setStartTime: (timeval_t)start { [controlSchedule at: start createActionTo: self message: M(start)]; return self; } - setStopTime: (timeval_t)stop { [controlSchedule at: stop createActionTo: self message: M(stop)]; return self; } - start { printf ("Starting: %lu\n", getCurrentTime ()); periodSchedule = [[[[Schedule createBegin: [self getZone]] setRepeatInterval: 1] setRelativeTime: YES] createEnd]; [periodSchedule createActionTo: self message: M(click)]; periodActivity = [periodSchedule activateIn: self]; return self; } - stop { printf ("Stopping: %lu\n", getCurrentTime ()); [periodActivity terminate]; return self; } - activateIn: swarmContext { [super activateIn: swarmContext]; [controlSchedule activateIn: self]; return [self getActivity]; } - click { printf ("click %lu\n", getCurrentTime ()); return self; } - run { [self activateIn: nil]; [[self getActivity] run]; return self; } @end int main (int argc, const char **argv) { initSwarm (argc, argv); [[[[[PeriodSwarm createBegin: globalZone] setStartTime: 10] setStopTime: 20] createEnd] run]; return 0; } /* Local Variables: compile-command: "${SWARMHOME}/bin/libtool-swarm --mode=link gcc -DDLL -o periodswarm -g -Wno-import -I${SWARMHOME}/include -L${SWARMHOME}/lib periodswarm.m -lswarmdll -lobjcdll" End: */