Marcus Daniels, 
09 Oct 2000 
PdV> In a swarm I have created two schedules: 
PdV>  - one repeating schedule
PdV>  - one non-repeating, autodrop schedule

PdV> If I activate each schedule separately there is no
PdV> problem. However, if I activate both schedules at the same time,
PdV> I get the following error (after more timesteps than the
PdV> repeatschedules length):

*** event raised for error: InvalidOperation
*** function: _update_mergeSchedules(), file:
/src/Swarm/swarm/src/activity/Schedule.m, line: 268

What you describe should work, and it does work for me using the
program
below and the current 2.1.1-fixes DLLs.  What is different about
your code?  Or maybe it gets fixed for you with new DLLs?

import swarm.Globals;
import swarm.objectbase.SwarmImpl;
import swarm.objectbase.Swarm;
import swarm.activity.Schedule;
import swarm.activity.ScheduleImpl;
import swarm.activity.Activity;
import swarm.defobj.Zone;
import swarm.Selector;

public class MixedSchedules extends SwarmImpl {
  Schedule autodropSchedule;
  Schedule repeatingSchedule;
  Selector autodropSelector;

  public void autodropMethod () {
    System.out.println ("method called by autodrop schedule @ " +
                        Globals.env.getCurrentTime ());
  }

  public void repeatingMethod () {
    int t = Globals.env.getCurrentTime ();
    int next = t +
Globals.env.uniformIntRand.getIntegerWithMin$withMax (0, 10);
    
    System.out.println ("method called by repeating schedule @ " + t
+ " next: " + next);
    autodropSchedule.at$createActionTo$message (next, this,
autodropSelector);
  }
  
  MixedSchedules (Zone aZone) {
    super (aZone);
    
    autodropSchedule = new ScheduleImpl (aZone, true);
    repeatingSchedule = new ScheduleImpl (aZone, 10);

    try {
      autodropSelector = new Selector (getClass (), "autodropMethod",
false);

      Selector repeatingSelector = new Selector (getClass (),
"repeatingMethod", false);

      repeatingSchedule.at$createActionTo$message (0, this,
repeatingSelector);
    } catch (Exception e) {
      e.printStackTrace (System.err);
      System.exit (1);
    }
  }

  public Activity activateIn (Swarm swarmContext) {
    super.activateIn (swarmContext);
    
    autodropSchedule.activateIn (this);
    repeatingSchedule.activateIn (this);
    return getActivity ();
  }

  static void main (String []args) {
    Globals.env.initSwarm ("MixedSchedules", "0.0",
"bug-swarm@swarm.org", args);

    MixedSchedules mixedSchedules = new MixedSchedules
(Globals.env.globalZone);
    mixedSchedules.activateIn (null).run ();
  }
  
}



