• 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
Re: Reordering a table insanity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reordering a table insanity


  • Subject: Re: Reordering a table insanity
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 28 Nov 2012 13:35:09 -0800

On Nov 28, 2012, at 13:02 , Quincey Morris <email@hidden> wrote:

> I think the loop algorithm needs to look like this:
>
> C1. Loop over the "less than" set starting from its highest index and working down. At each iteration, move the row at the current index to 'targetIndex - 1'. (But don't decrement targetIndex here.)
>
> C2. Loop over the "greater than" set starting from its lowest index and working up. At each iteration, move the row at the current index to the targetIndex row, and increment targetIndex.

Ugh, I think I made the same mistake again. The decrement has to be there:

C1. Loop over the "less than" set starting from its highest index and working down. At each iteration, move the row at the current index to 'targetIndex - 1' and decrement targetIndex.

C2. Reset targetIndex to its original value.

C3. Loop over the "greater than" set starting from its lowest index and working up. At each iteration, move the row at the current index to 'targetIndex', and increment targetIndex.

_______________________________________________

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: Reordering a table insanity
      • From: Graham Cox <email@hidden>
References: 
 >Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Reordering a table insanity
  • Next by Date: Does anyone find Restore Snapshot kind of weak?
  • Previous by thread: Re: Reordering a table insanity
  • Next by thread: Re: Reordering a table insanity
  • Index(es):
    • Date
    • Thread