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 21:05:12 -0800
On 平成 17/03/19, at 18:40, mmalcolm crawford wrote:
On Mar 19, 2005, at 6:01 PM, アンドレ(Andre) wrote:
Please don't cross-post.
Right. (I guess that also means not the initial post too)
Follow-ups to email@hidden.
For example, say I only have two items in my sparse array, but the
second item is in position 33. If I have my object return
countOf<Key> to return 33 would that be good enough?
When the controller gets a change to another position below 33 I
could handle it and
abstract it with objectIn<Key>AtIndex: etc, but what I am worried
about is anything above
33.... what would happen if I returned INT_MAX for countOf<key>
would that cause the
NSArrayController to allocate space for 2 billion items?? Or is it
smart enough?
What happens if you try it?
(Hint: Why would the array controller allocate space for the objects?)
I suppose that since it is managing an array.... but not in this case,
which is great. BUT...
I suppose I mis-phrased my problem....
If my data source is the sparseArray object, then this is not
necessarily the problem since I am the content of the controller.
But what I want is the controller to manage its own standard NSArray
and have my custom SparseArray reflect changes in it.
The problem then stems from the fact that when an insertObject:object
inXXXAtIndex:1, changes in the index "1" may not necessarily
mean index "1" in the sparse array.... thats the whole point of a
sparse array, I can insert something at index 120000 and not incur much
more memory
than is needed for just one object... (each inserted object would
contain some info such as the place in a grid it belongs (index) etc.)
In other words, my SparseArray feeds off of NSArray controller that is
intern connected to a managed Object context. (MOC is publicly
available info)
The reason I have a SparseArray in the first place is for caching
reasons, but when changes occur from the array/controller, I of course
want my sparseArray
to reflect it. The sparseArray doesn't necessarily have to propagate
changes back to the controller, since its just a cache...
So I suppose the only recourse is to scan each object that changes in
the Array-Controller (from KVO), find its "real" index and place it in
my sparse array appropriately....
So, I want to take advantage of everything C/D and bindings have to
offer, it just seems the question is, how to monitor changes from an
Array that is very concrete and one that is more abstract... i.e object
at index 1 may actually have an ivar set to 33000, so in the SArray it
needs to be at that index not 1.
Thanks for your response BTW.
Is there any way to do this besides getting all the items in a
given array, iterate their "position" key to find the ones I want
changed or removed??
How are you managing your sparse array? If you know the indexes of
the items in your array, then you should be able to do whatever is
appropriate in the indexed accessor methods?
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