swarm-support
[Top][All Lists]
Advanced

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

grid2d suggestion


From: Paul E Johnson
Subject: grid2d suggestion
Date: Wed, 19 Jul 2000 12:32:47 -0500

I found this handy in a subclass of Grid2d I have been using. Could it
be installed in Grid2d?

If you want something done by each object in a Grid2d:

- passThrough: (SEL) aSelector
{
  int x,y;
  id cell;

  for (x=0;x< xsize; x++)
    for (y=0; y<ysize; y++)
      {
          cell = *discrete2dSiteAt(lattice, offsets, x, y);
        if (cell)
          [cell perform: aSelector];
      }
  return self;
}


For completeness, I suppose I'd also want to be able to pass arguments,
so :

- passThrough: (SEL) aSelector : arg1
{
  int x,y;
  id cell;

  for (x=0;x< xsize; x++)
    for (y=0; y<ysize; y++)
      {
          cell = *discrete2dSiteAt(lattice, offsets, x, y);
        if (cell)
          [cell perform: aSelector with: arg1];
      }
  return self;
}

and so forth.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

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