FW: [Q] Best data structure for...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: [Q] Best data structure for...

jgfoster
If you are using GLASS (http://seaside.gemstone.com), you add your data to
an UnorderedCollection (typically an IdentitySet) and then ask it to keep
things indexed for you.

        myCollectionOfData
                createEqualityIndexOn: title        withLastElementClass:
String;
                createEqualityIndexOn: creationDate withLastElementClass:
Date  ;
                createEqualityIndexOn: modifiedDate withLastElementClass:
Date  ;
                createEqualityIndexOn: type         withLastElementClass:
Symbol;
                yourself.

>From then on the indexes are automatically updated based on adds and
removes. Queries use a special "select block" syntax:

        recentDate := Date today subtractDays: 10.
        recentlyModified := myCollectionOfData select: {:each |
each.modifiedDate >= recentDate}.

James

On Nov 25, 2007 10:22 PM,  <[hidden email]> wrote:

> Hi,
>
> my data class has following attributes;
>
> title
> content
> creation date
> modified date
> type
>
> and except content, the collection of
> elements of this data shlould be indexed; that is,
> title, creation/modified date and type be key.
>
> If single key is required, then dictionary will be my choice(or
> should I use tree?). What is the best data structure for multiple
> keyed data? This question has been one of my hurddle to the
> OODB; if like now, sql db will be used, I know how to handle this.
>
> Thanks in advance.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside