Re: Reordering a table insanity
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