swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Re: trouble with index


From: Scott Christley
Subject: Re: [Swarm-Support] Re: trouble with index
Date: Wed, 12 May 2004 16:51:10 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040301

emcleskey wrote:

Scott,
I did not have Flowfield.h #include 'ed in! That was it. I actually had defunct -getXPos and -getYPos functions in the BrownTrout.m file as well (the same place -step was) that I was initially going to use but ended up not needing and then neglected to take out. The complier was looking at those functions and giving me the error message. Thank you!

So, the header file of the class the list contains must be included in the implementation file where the method referencing that list is declared? It wasn't clear to me from the swarm user guide that I had to include that file. Like I said, I'm relatively new to swarm and programming in general. So if I can ask one more question, same topic...

Yeah, this is more of an ObjC thing then anything to do with Swarm. The point is that the compiler must see the declaration of the methods so that it knows the return data type(and parameters as well); it cannot assume that the return type is the same as your variable data type, because they are allowed to be different if one can be "cast" to the other.


My code (called in the brownTrout class) indexes through one list created in and containing objects of the flowfield class and then (as specified in the 'while loop')adds them to another list CREATED in the brownTrout class BUT containing flowfield objects. If I then want to index through that list (created in one class but containing items from another) and call functions, do I put them in the brownTrout.m or flowfield.m file?

It seems like the functions should be declared in the implementation file of the class contained in the list. Is that correct?


It is not exactly clear to me what you are doing. If you are asking if BrownTrout should be allowed construct a list of FlowField objects, then this sounds reasonable to me. The opposite is just as reasonable where a FlowField constructs a list of BrownTrout. Which way you implement is more of a conceptual question for how you perceive your model. Maybe BrownTrout are sensing local FlowField and performing actions based upon that, or maybe FlowField is detecting what BrownTrout are around and adjusting itself; or maybe both is occuring. It is not uncommon for environment and agents to have a circular relationship with each other so that both viewpoints are reasonable.


cheers
Scott




reply via email to

[Prev in Thread] Current Thread [Next in Thread]