swarm-support
[Top][All Lists]
Advanced

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

Remove event from a schedule


From: Olivier Jauze
Subject: Remove event from a schedule
Date: Wed, 01 Aug 2001 11:06:50 +0200

Hi

When I remove an agent from my simulation,
I have to remove all the actions of this agents in the modelSwarm' schedule.

But I have a problem :
I make an index on this schedule and then I traverse the index to look at actions of this agent.

If the current action is an ActionTo, I can remove it because I can know what is the target of this AactionTo.
But if it is an ActionConcurrent, I don't know how to do this.

Here this my method to remove ActionTo :

      Index indexAction = modelSchedule.begin(getZone());
      Object   tmpObj   = indexAction.next();
      ActionTo actionCour;

      try
      {
          while ( tmpObj != null )
          {
if ( tmpObj.getClass() == Class.forName("swarm.activity.ActionToImpl") )
              {
                  actionCour = (ActionTo)tmpObj;
                  if ( actionCour.getTarget().equals(vacheIn) )
                      indexAction.remove();
              }
             tmpObj = indexAction.next();
          }
      }
      catch (Exception e)
      {
System.out.println("Exception lors de la suppression de la vache : " + vacheIn.id);
      }

Is there a way to remove all actions of an agent without consider the type of actions.

Thanks for your 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]