[Glass] Question on Sets

Sebastian Heidbrink sebastian_heidbrink at yahoo.de
Fri Apr 4 08:44:02 PDT 2014


Hi!

I just found out that I have some trouble with Sets here.
I use Gemstone/Web 3.1.0.5

If I do
Set new add: MyClass new; add: MyClass new; yourself inspect
then MyClass is twice in the Set,... I expected such behavior for IndentitySet and not Set.
Similar problem with removing MyClass new from this very Set. The MyClass isn't found in the set eventhough it is there.

Set new add: MyClass new; add: MyClass new; yourself; removeAllPresent: #(MyClass new); yourself

Since this seems to work for "basic/primitive" classes I started to search.

In the documentation I could find the following comment:

"If the Bag or Set contains elements
that are themselves complex objects,
determining the equality is complex and
therefore slower than you might have
hoped. GemStone recommends using Identi
tyBag or IdentitySet for anything but
the most simple unordered collections"

So what would then be my best approach for the following task?
I have HTTP interfaces to my server using a csv based data protocol. I parse the CSV with NeoCSV and
Does this mean for a DELETE request that I will need to take the data delivered, select similar objects from my sets, then remove them with "removeAll: myFoundOnes" ?
I was hoping I could just send a removeAllPresent: myDeliveredfromCSVParsedEntities.
This does currently not work since the Set claims that it doesn't include any of the provided enitites,.. eventhough they there and "similar".

If I implement it with the select first then remove it approach,... what will happen when I want to remove/replace a lot of data? Are there any tricks performance-wise?

I do remember that I once read something in the documentation about having to write my own "=" operand in my classes, but I wasn't able to find it againand I am also not 100% sure anymore.

Any help or advide is highly appreciated!
Thanks
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140404/6112ede0/attachment.html>


More information about the Glass mailing list