Marcus Daniels, swarm-support, June 21, 2000 FM> will the behaviour of the PermutedIndex objects be correct, FM> considering that all the agents (except the last one) have built FM> their PermutedIndex object on an incomplete (not fully FM> initialized) collection? The index will reflect the contents of the collection as of the time the index was created; the index creation should be delayed. Say, like this: #import // initSwarm #import // Array #import // CreateDrop #import // Swarm #import // getZone #define COUNT 10 @interface Agent: CreateDrop { id population; unsigned ID; } + create: (id )aZone setPopulation: (id )thePopulation setID: (unsigned)theID; - (unsigned)getID; - (void)permutePopulation; @end @implementation Agent + create: (id )aZone setPopulation: (id )thePopulation setID: (unsigned)theID { Agent *obj = [self createBegin: aZone]; obj->population = thePopulation; obj->ID = theID; return [obj createEnd]; } - (unsigned)getID { return ID; } - (void)permutePopulation { id index = [population beginPermuted: getZone (self)]; id member; printf ("Agent: %u sees permutation:", ID); for (member = [index next]; [index getLoc] == Member; member = [index next]) printf (" %u", [member getID]); printf ("\n"); [index drop]; } @end @interface ModelSwarm: Swarm { id population; } - buildObjects; @end @implementation ModelSwarm - buildObjects { unsigned i; [super buildObjects]; population = [Array create: globalZone setCount: COUNT]; for (i = 0; i < COUNT; i++) [population atOffset: i put: [Agent create: self setPopulation: population setID: i]]; return self; } - (void)test { [population forEach: M(permutePopulation)]; } @end int main (int argc, const char **argv) { initSwarmBatch (argc, argv); { id modelSwarm = [ModelSwarm create: globalZone]; [modelSwarm buildObjects]; [modelSwarm test]; } return 0; } /* Local Variables: compile-command: "/opt/SDGswarm/2.1.1/bin/libtool-swarm --mode=link gcc -o arrayTest -Wall -Werror -g -Wno-import -I/opt/SDGswarm/2.1.1/include -L/opt/SDGswarm/2.1.1/lib arrayTest.m -lswarm -lobjc" End: */