Re: Faking large arrays in bindings to satisfy sparse data...
Re: Faking large arrays in bindings to satisfy sparse data...
- Subject: Re: Faking large arrays in bindings to satisfy sparse data...
- From: アンドレ(Andre) <email@hidden>
- Date: Sat, 19 Mar 2005 22:33:59 -0800
On 平成 17/03/19, at 21:28, mmalcolm crawford wrote:
On Mar 19, 2005, at 9:05 PM, アンドレ(Andre) wrote:
If my data source is the sparseArray object, then this is not
necessarily the problem since I am the content of the controller.
Sorry, I'm confused now. What manages the sparse array, what does it
represent, what is the role of the array controller...?
OK, I'm sorry for confusing you more...
I was going to have the sparse array simply managed by KVO so that it
reflected what changed in the Controller.
The controller then talks to the persistent store.
The reason for the sparse array is that I have a view that is like a
grid, but could contain say 300 or even 10000 rows
that each in tern contain maybe 1000+ columns in each. So a sparse
array is really quick to knock out default values in
index that are not initialized. Now, I could just link my sparse array
to the NSController, and I still have plenty of speed,
but I also want to use the persistent store and all the good stuff it
has to offer. If my main data source is my sparse array,
then I gotta handle all that manually, which I would rather not do
since I have my data and relations already modeled...
So, if I need to move data in a huge grid super fast, I can't have time
to go through the controller, then through the P/S and so on.
Changes to the underlying relations of course go through the managed
object context then the persistent store, then
the controller layer will notify my "cache" (the sparse array) that a
value(s) have changed...
IOW, in my app things are going to be observed more often than edited...
So, the point is, can my custom cache, that would like to be bound to
the controller to observe
changes using bind:toObject:withKeyPath:options to the controller, its
gonna come back with KVO and invoke
observeValueForKeyPath:ofObject:change:context: I'll then get an array,
but say the array only contains 5 objects
and those 5 objects actually are set to be in different position in the
grid than what their place in the array implies.
I'll then have to go and do a scan of each object, get their position
[object colIndex] and place it in the sparse array appropriately.
It wold be much faster and straight forward to just get a changed
object's index and push it in without having to message
things very much...
I thought maybe I could just grab an array of the changed Indexes
(NSKeyValueChangeIndexesKey) but the items contained in the indexes in
the
array/controller don't match to the logical index value where they
would be displayed. So it does seem that I'll unfortunately
have to iterate over the array that I get back and find grab they're
"index value" each one at a time....
I was hoping that somehow I would trick the Array Controller to do
things the way I wanted so I could just move things 1:1 ....
I.E whatever object moved to a different column or another, I wouldn't
need to check manually, just take its index value
at face value and insert it.... but with NSArray its not practical
because its not sparse, so inserting at index 300 requires a
big malloc, sorting, etc...
I think I know what I need to do....
Thanks again for the reply.
I appreciate it.
mmalc
_______________________________________________
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
_______________________________________________
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