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: Sat, 08 May 2004 10:55:35 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040301

emcleskey wrote:

Scott,
Thanks for your reply. To answer your questions: The return type for -getXPos and -getYPos is float. Here's how I wrote -getXPos (-getYPos is written the same except sub Y for X):

- (float) getXPos{
 return xPos;
}

I'm not sure I know what you mean when you ask 'what class is element'.


I can see that the element variable is of type id, what I meant is the instances which are stored in the Index, what class are they. I'm guessing from your later comments though that this is class FormField, which should be the class that defines the -getXPos and -getYPos methods. So for the file that contains the code below, your while loop which calls those methods, is that file #include'ing the FormField.h file? The only thing I can think of is the compiler is confused about the return type of those methods. Another thing to try is to explicitly cast the element variable to the class so that the compiler knows exactly which class to look for the methods.

elementX = [(FormField *)element getXPos];

This may be a compiler issue, but sometimes it is hard to tell. I think some versions of the compilers on Linux would give errors like this, but I don't really remember the details.


while((element = [flowfieldIndex next]) != nil){
      elementX = [element getXPos];
      elementY = [element getYPos];

      if(elementX > xLow && elementX < xHigh && elementY > yLow &&
elementY < yHigh)
              [nodesICanSee addLast: element];
}
[flowfieldIndex drop];




reply via email to

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