swarm-support
[Top][All Lists]
Advanced

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

Re: Event


From: Olivier Jauze
Subject: Re: Event
Date: Tue, 31 Jul 2001 08:41:26 +0200


Olivier,

here's one way to do it. In the BatchSwarm and/or the ObserverSwarm, you insert code like this:

// a. In method buildActions() insert a stop schedule like this (where 'experimentDuration'
// is the step at which you want the simulation to stop):

      stopSchedule = new ScheduleImpl(this.getZone(), true); // autodrop

      stopSchedule.at$createActionTo$message
           (experimentDuration, this, new Selector
                (this.getClass(), "stopRunning", false) );


// b. Then you need a method like this that executes when the above action is triggered:

    public void stopRunning () {

        System.out.println
                ("BatchSwarm: Quitting at " + Globals.env.getCurrentTime() );

        // (Do other desired housekeeping chores here)

        Globals.env.getCurrentSwarmActivity().terminate();

    }

That should take care of it. (Translate as needed if you are running objective-C.)

Cheers,
Sven Thommesen

thanks, it is exactly what I want to do.
Have a good day and thanks for you help.
Olivier JAUZE
INRA unité URH équipe SP
Centre de Theix

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