Repetive problem with indexed attribute

Hilaire Fernandes hilaire at ofset.org
Thu Feb 7 14:19:21 UTC 2008


Replying to myself aswell, casting to 'OrderedCollection' helps a lot.

Hilaire


Le jeudi 07 février 2008 à 15:00 +0100, Hilaire Fernandes a écrit :
> In my quest to write tests to control Magma behaviour, I have found the
> following problem:
> 
> With a magma collection of users object defined as follow:
> 
> | users |
> users := MagmaCollection new.
> users
> 	addIndex: (MaIntegerIndex attribute: #id);
> 	addIndex: (MaKeywordIndex attribute: #functions);
> 	addIndex: (MaSearchStringIndex attribute: #schoolYear).
> ^ users
> 
> I have problem with the #functions key.
> functions is instanciated as an empty OrderedCollection.
> I can update function with #function: message
> 
> functions: aCollection 
> (self class functions includesAllOf: aCollection) 
> 	ifTrue: 
> 		[IFIDbSession commit: 
> 			[IFIDbSession noteOldKeyFor: self.
> 			functions := aCollection]]
> 
> 
> In my test, I can do:
> 
> 	adult functions: #(#teacher).
> 	self should: adult functions = #(#teacher).
> 
> but the next one got the error (see SqueakLog enclosed)
> 
> 	adult functions: #(#teacher #admin).
> 	self should: adult functions = #(#teacher #admin).
> 
> If I change the previous test code to:
> 	adult functions: #(#director #admin ).
> 	self should: adult functions = #(#director #admin ).
> 
> It is fine.
> 
> It seems the problem appear when two successive changes to functions has
> common value, here #teacher was in both #(#teacher) and #(#teacher
> #admin)
> 
> Please help!
> 
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.squeakfoundation.org/pipermail/magma/attachments/20080207/7706de7d/attachment.pgp


More information about the Magma mailing list