From: Maciej S. <m.s...@gm...> - 2006-07-29 21:28:02
|
Well, I guess we have two options: 1. Rewrite any code that depends on ordering not to depend on ordering. 2. Rewrite Set<T> to implement IList<T>. It sounds kind of crazy, but if Set<T> uses two data structures, a List<T> to hold the actual T items, and a Dictionary<T,int> to hold a mapping from the T items to positions in the list, we should be able to get it to work without too big a performance hit. Of course, this raises memory requirements for the Set<T> by at least 50%. Although if we're really concerned about memory usage, we should not use a Dictionary<T,bool> internally but rewrite Set<T> to do its own hashing... I'll give Option 1 a shot first, once I commit the Trie/SearchTree business. If that doesn't pan out, we can consider Option 2. -Maciek On 7/29/06, Jimmy Do <cri...@gm...> wrote: > I like the idea, but I'm hesitant because some of the filtering or > grouping code does rely on ordering so that the pictures show up in > the right order in the thumbnail view. But it would be nice to use > Set<T>, so maybe you can give it a try and see if it can be done? > > Jimmy > > On 7/28/06, Maciej Sakrejda <m.s...@gm...> wrote: > > So we use List<T>s (or at least IList<T>s) all over the place, where > > we are implicitly ignoring the occurence of duplicates. Should we > > maybe move this all to Set<T>s? I've added a lot of stuff to the > > Set<T> class, and have tested it thoroughly. Maybe we should move to > > ISet<T>s instead, in case we ever feel like implementing a Set<T>-like > > class in another way. Either way, though, it seems like it's a bad > > idea to use IList<T>s where we really mean "IList<T>, but with no > > duplicates". I guess the major catch is that since Set<T> is > > implemented on top of a dictionary, and not a list, we lose the > > ordered property. I don't know if any code actually depended on this. > > Set<T> does implement ICollection (among other things), so it should > > be pretty easy to work with, but I thought I'd check with you guys in > > case there is a good reason to use IList<T> in some place (mostly I'm > > talking about passing around IList<T>s of IPictureInfos for filtering > > purposes)... > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys -- and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Snap-photo-devel mailing list > > Sna...@li... > > https://lists.sourceforge.net/lists/listinfo/snap-photo-devel > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Snap-photo-devel mailing list > Sna...@li... > https://lists.sourceforge.net/lists/listinfo/snap-photo-devel > |