2014-02-04 waldo kitty <wkitt...@windstream.net>: > On 2/4/2014 3:28 PM, Jim Leonard wrote: > >> On 2/4/2014 1:40 PM, waldo kitty wrote: >> >>> >>> i have a TSortedCollection that i'm allowing duplicate keys to be >>> inserted in... the problem that i'm having is that the duplicate keys >>> are in reverse order from how they were inserted... >>> >> >> Sounds like your TSortedCollection.Compare() needs additional logic. It >> isn't >> doing enough comparisons internally to order things properly. >> > > possibly... i dunno... currently it compares the (pstring) keys only... i > thought about trying to also include a second field (a double) which is > used for the "time stamp" but i don't know how to do that without having to > use the key and this "time stamp" field every time i do anything with the > records... > > > i am overriding MyCollection^.Insert because i have additional tasks >>> that need to be done at the time of insertion... without duplicate keys, >>> >> >> Wouldn't it be better to perform your additional tasks before the >> insertion, >> then call a normal .Insert? Why overload something if there isn't really >> a need >> to? >> > > i kinda thought about that earlier when i was digging thru the code... > IIRC, insert was overridden because there are cases where the existing > record needs to be replaced (because the new record is newer) using AtPut > and the non-added records must be logged and their reason for not being > added (older or same)...
Just a quick idea which could be completely wrong, but wouldn't it solve your issue if Compare always returned -1 instead of 0? -- Frederic Da Vitoria (davitof) Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal