ESSwarm.m
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:1k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /*
  2. Name:         ESSwarm.m
  3. Description:  EmptyScheduleSwarm
  4. Test suite:   activity
  5. */
  6. #import "ESSwarm.h"
  7. #import <activity.h>
  8. #import <defobj/defalloc.h>
  9. BOOL ok = NO;
  10. @implementation ESSwarm
  11. - buildActions
  12. {
  13.   firstSchedule = [Schedule createBegin: getZone (self)];
  14.   [firstSchedule setAutoDrop: YES];
  15.   [firstSchedule setKeepEmptyFlag: YES];
  16.   firstSchedule = [firstSchedule createEnd];
  17.   
  18.   secondSchedule = [Schedule createBegin: getZone (self)];
  19.   [secondSchedule setAutoDrop: YES];
  20.   secondSchedule = [secondSchedule createEnd];
  21.   
  22.   [firstSchedule at: 2 createActionTo: self message: M(empty)];
  23.   [secondSchedule at: 3 createActionTo: self 
  24.   message: M(schedulePrintOkOnFirstSchedule)];  
  25.   return self;
  26. }
  27. - activateIn: swarmContext 
  28. {
  29.   [super activateIn: swarmContext];
  30.   [firstSchedule activateIn: self];
  31.   [secondSchedule activateIn: self];
  32.   return self;
  33. }
  34. - schedulePrintOkOnFirstSchedule
  35. {
  36.   [firstSchedule at: (timeval_t) 5 createActionTo: self 
  37.  message: M(printOk)];
  38.   return self;
  39. }
  40. - empty
  41. {
  42.   return self;
  43. }
  44. - printOk
  45. {
  46.   printf ("Ok!n");
  47.   ok = YES;
  48.   fflush (stdout);
  49.   return self;
  50. }
  51. @end