• 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
Mutually exclusive item filtering-comparing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mutually exclusive item filtering-comparing


  • Subject: Mutually exclusive item filtering-comparing
  • From: Chris Paveglio <email@hidden>
  • Date: Tue, 05 Nov 2013 10:17:35 -0800 (PST)

What is the most efficient way to compare a list of mutually exclusive items? I know this isn't exactly Cocoa/iOS specific. I have a table that needs to disable certain rows based on what other rows are selected.

I have several objects, let's say "weapons in a game". Such as a bow and arrow, a rifle, a bazooka.
A character can use any of the objects, but some can't be used together. A bazooka is too big and requires 2 hands to carry so you can't select both a bazooka and rifle at the same time. You can select bow & arrow and rifle, but if you select both of those, you can't take the bazooka too. I hope you get the idea.

My exclusions array has many simple objects. Each object has 3 ivars- (int)itemID1, (int)itemID2, (string)isMutuallyExclusive (not my design but could be changed if there is a better way).

The idea I have is whenever a row is selected, I will take the itemID of that item, then iterate with every other itemID in the table- then I do an iteration on every object in the exclusions array. If the selected row itemID is in the exclusion object, and current row itemID being compared are both in the exclusion object, I can get it's exclusion (non-exclusive items won't be in the list).
So, repeat with 100 items in the table, each table row comparing against the exclusion list which has over 100 entries. It could result in up to 10,000 comparisons getting tested until the exclusion is found or exhausted.

It seems extremely process intensive. Is there a better way, or some basic concept I might be missing?

Thanks,
Chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Mutually exclusive item filtering-comparing
      • From: Joseph Dixon <email@hidden>
    • Re: Mutually exclusive item filtering-comparing
      • From: Graham Cox <email@hidden>
    • Re: Mutually exclusive item filtering-comparing
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: MDItemCopyAttributes replacement for audio
  • Next by Date: Re: MDItemCopyAttributes replacement for audio
  • Previous by thread: Re: MDItemCopyAttributes replacement for audio
  • Next by thread: Re: Mutually exclusive item filtering-comparing
  • Index(es):
    • Date
    • Thread