Collection Object -- I need to know your needs.

Shaun Wexler dev at macfoh.com
Tue Aug 1 15:15:28 CDT 2006


On Aug 1, 2006, at 2:34 PM, Ruslan Zasukhin wrote:

> On 8/2/06 12:25 AM, "Shaun Wexler" <dev at macfoh.com> wrote:
>
>> Create an IndexSet class, and store an array of index ranges.
>
> In RAM?
>
> IndexSet this is some Apple class?

Yes, NSIndexSet.

> But this will not work for big dbs in few Gbs then

If all records are disjoint, it will consume no more storage than an  
array or set.  Any adjacent records reduce the size of the index  
set.  It is a series of sorted ranges, such as:  { 0-12, 39, 41-45,  
937, 2048 } which in this case represents 21 unique values, stored as  
7 int's.  In memory, you'd store it like this:  12, 0, 39, 45, 41,  
937, 2048, with count=21 and length=7.  If a value is greater than  
the value to its left, its either a unique value or (if the value to  
its right is less) then it is the end of a range.  Cool?  ;)

This works for any kinds of values which can be compared < or >,  
though non-int's need to declare a minimum epsilon granularity.
-- 
Shaun Wexler
MacFOH
http://www.macfoh.com





More information about the Valentina mailing list