//Marcus Daniels 8-12-2000 KY> If I write following code in ModelSwarm, the methods of updated KY> members in the list are not scheduled, but the methods of initial KY> members in the list are scheduled. The problem is here: KY> actionForEach = modelActions.createFActionForEachHomogeneous$call (The use of ForEachHomogeneous rather than ForEach.) Here's an example of a ForEach action where the set of target objects get updated each time step by the method "swarmStep". import swarm.objectbase.Swarm; import swarm.objectbase.SwarmImpl; import swarm.activity.Schedule; import swarm.activity.ScheduleImpl; import swarm.activity.Activity; import swarm.activity.ActionGroup; import swarm.activity.ActionGroupImpl; import swarm.defobj.Zone; import java.util.List; import java.util.LinkedList; import swarm.Globals; import swarm.Selector; class Agent { int id; Agent (int id) { this.id = id; } public void agentStep () { System.out.println (id + "@" + Globals.env.getCurrentTime ()); } } public class TestForEach extends SwarmImpl { Schedule schedule; ActionGroup actionGroup; List list; int lastAgentId = 0; TestForEach (Zone aZone) { super (aZone); list = new LinkedList (); swarmStep (); actionGroup = new ActionGroupImpl (aZone); schedule = new ScheduleImpl (aZone); try { Selector aSel = new Selector (Agent.class, "agentStep", false); Selector sSel = new Selector (TestForEach.class, "swarmStep", false); actionGroup.createActionForEach$message (list, aSel); actionGroup.createActionTo$message (this, sSel); schedule.at$createAction (0, actionGroup); schedule.at$createAction (1, actionGroup); schedule.at$createAction (2, actionGroup); } catch (Exception e) { e.printStackTrace (System.err); System.exit (1); } } public void swarmStep () { list.add (new Agent (lastAgentId)); lastAgentId++; } public Activity activateIn (Swarm context) { super.activateIn (context); schedule.activateIn (this); return getActivity (); } public static void main (String[] args) { Globals.env.initSwarm ("TestForEach", "0.0", "bug-swarm@swarm.org", args); Swarm swarm = new TestForEach (Globals.env.globalZone); swarm.activateIn (null).run (); } }