• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Predicate on two values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Predicate on two values


  • Subject: Predicate on two values
  • From: Scott Ellsworth <email@hidden>
  • Date: Mon, 27 Jun 2005 15:41:57 -0700

Hi, all.

I cannot figure out how to write a predicate that will query for objects whose X and Y values are in a list of pairs, both of which must be satisfied.

Details:

I have a Location attribute in my Core Data model that tells my program the X and Y location of a graphic. These are modelled as, appropriately enough, int16 attributes.

I want to find all graphics at certain locations near to a selected object. Thus, I want to query my store for all Location instances whose X and Y values are in a list of pairs.

For example, if I am at (1,3), I want to find any locations with (X,Y) = (3,3) and (1,5), but not (1,3) or (3,5). (The actual list is about twenty possible points, and will be run a fair number of times.)

I have a function that returns an NSArray of NSNumber instances: [3,3,3,5,3,1,...], though I also have versions that return an array of arrays, and one that send back just the x and one that gave back just the y values.

Obviously, it would not be hard to write a predicate that returned all locations whose X value was 1 or 3, and Y was 3,or 5, but that would return points that do not qualify.

Any suggestions on how to approach this?

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Why add a nil item to an NSArray ?
  • Next by Date: Re: Convert PICT to NSImage
  • Previous by thread: Re: Replacing a method via categorys
  • Next by thread: Inserting into NSArrayController
  • Index(es):
    • Date
    • Thread