[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SWARM problems (followup question)
From: |
Doug Donalson |
Subject: |
Re: SWARM problems (followup question) |
Date: |
Wed, 24 Jun 1998 22:51:14 -0700 |
Paul,
First, aZone=[self getZone] is the same thing as the [self getZone] in the
create
statement. If I were to complete something I probably started LONG ago, I
would
put aZone in the create statement so save processing time on function calls.
Obviously I forgot to complete it, thanks for reminding me. :-)
The "offsetof" is a Swarm list option. It allows you to send a message to a
list of
the sort [aList remove: aDeadBug].
Normally you would create an index and then do a:
while( (aBug=[index next]) != aDeadBug] )
This just automates it.
What would really be nice is if it didn't have to traverse the list everytime
(Hive:
hint hint hint ). If the member is known and the remove could be done directly
from
the member then a high use O(n) function could be changed into an O(1).
That is one of the two things at the top pf my Swarm wish list, and it really
is a
"list".
Cheers,
D3
Paul Johnson wrote:
> Dear Doug:
> Thanks for sharing that code. I understood almost all, except
> I wonder what offsetof( x, y ) is. Is that a ordinary c function
> you have written? What is its purpose?
>
> What job are you aiming to get done with the customization of the list,
> I guess I wonder.
>
> What purpose do you serve by
>
> aZone=[self getZone]; ???
>
> Can't learn if I don't ask questions, you know!
>
> pj
>
> On Wed, 24 Jun 1998, Doug Donalson wrote:
>
> > Here is create end where I set up the four lists.
> >
> > -createEnd
> > {
> > id listType;
> > id aZone;
> >
> > active=1;
> > aZone=[self getZone];
> >
> > listType = [List customizeBegin: [self getZone]];
> > [listType setIndexFromMemberLoc: offsetof( AdultAphytis, listMember )];
> > listType = [listType customizeEnd];
> >
> > adultAphytisList = [listType create: [self getZone]];
> >
> > listType = [List custiomizeBegin: [self getZone]];
> > [listType setIndexFromMemberLoc: offsetof( AdultRedScale, listMember )];
> > listType = [listType customizeEnd];
> >
> > adultRedScaleList=[listType create: [self getZone]];
> >
> > listType = [List customizeBegin: [self getZone]];
> > [listType setIndexFromMemberLoc: offsetof( JuvenileAphytis, listMember )];
> > listType = [listType customizeEnd];
> >
> > juvenileAphytisList = [listType create: [self getZone]];
> >
> > listType = [List customizeBegin: [self getZone]];
> > [listType setIndexFromMemberLoc: offsetof( JuvenileRedScale, listMember
> > )];
> > listType = [listType customizeEnd];
> >
> > juvenileRedScaleList=[listType create: [self getZone]];
> >
> >
> > return self;
> > }
> >
> > I hope this helps a little?
> >
> > Cheers,
> >
> > D3
> >
> >
> > Laurence wrote:
> >
> > > Hi,
> > >
> > > I'm currently working on a model of chemotaxis using SWARM, and need some
> > > advice. I use objects to represent enzymes / proteins in the system that
> > > signal each other. I have different classes to represent each type of
> > > component, and the present program contains 1 object of each class. I now
> > > need to extend it so that each protein type is represented in it's
> > > relative
> > > concentration.
> > >
> > > 1) How can I create / manage a population of objects of different classes?
> > > Do I need to use lists? Do I need a seperate list to hold the objects of
> > > each class? Can you point me in the direction of some code that does
> > > similar
> > > stuff?
> > >
> > >
> > >
> > > Best wishes, Laurence (address@hidden)
> > > ---------------------
> > > http://www.csc.liv.ac.uk/~laurence
> > >
> > > ==================================
> > > 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.
> > > ==================================
> >
> >
> >
> > --
> > ************************************************************************
> > * Doug Donalson * Office: (805)
> > 893-2962
> > * Ecology, Evolution, and Marine Biology * Home: (805) 961-4447
> > * UC Santa Barbara * email
> > address@hidden
> > * Santa Barbara Ca. 93106 *
> > ************************************************************************
> > *
> > * The most exciting phrase to hear in science, the one that
> > * heralds new discoveries, is not "EUREKA" (I have found it) but
> > * "That's funny ...?"
> > *
> > * Isaac Asimov
> > *
> > ************************************************************************
> >
> >
> >
> > ==================================
> > 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.
> > ==================================
> >
>
> Paul E. Johnson address@hidden
> Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
> University of Kansas Office: (913) 864-9086
> Lawrence, Kansas 66045 FAX: (913) 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.
> ==================================
--
************************************************************************
* Doug Donalson * Office: (805)
893-2962
* Ecology, Evolution, and Marine Biology * Home: (805) 961-4447
* UC Santa Barbara * email
address@hidden
* Santa Barbara Ca. 93106 *
************************************************************************
*
* The most exciting phrase to hear in science, the one that
* heralds new discoveries, is not "EUREKA" (I have found it) but
* "That's funny ...?"
*
* Isaac Asimov
*
************************************************************************
==================================
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.
==================================