Hi Alex,
Nice catch. Indeed, this is a bug. The method was actually used only for constants like Color white, so I never detected it :)
Cheers, Doru
On 8 Mar 2010, at 19:55, Alexandre Bergel wrote:
RectangleShape>>ifTrue: conditionBlock fillColor: colorBlock | oldBlock | oldBlock := self fillColor ifNil: self defaultFillColor. ^self fillColor: [ :each | (conditionBlock mondrianValue: each) ifTrue: [ colorBlock ] ifFalse: [ oldBlock ]].
Shouldn't a "mondrianValue: each" be added after colorBlock and oldBlock ? I added: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= MOFilledShape>>if: conditionBlock fillColor: colorBlock | oldBlockOrValue | oldBlockOrValue := self fillColor ifNil: [ self defaultFillColor ]. ^self fillColor: [ :each | (conditionBlock moValue: each) ifTrue: [ colorBlock moValue: each ] ifFalse: [ oldBlockOrValue moValue: each ]]. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Added if:fillColor: and testConditionalColor in 388
Cheers, Alexandre
On 7 Mar 2010, at 23:02, Stéphane Ducasse wrote:
ok but still send the code because right now I do not get it.
Stef
On Mar 7, 2010, at 5:37 PM, Alexandre Bergel wrote:
I method that I wrote some times ago. It sorts collection in a fancy way.
Alexandre
On 7 Mar 2010, at 13:10, Stéphane Ducasse wrote:
what is sortedAs:
STf On Mar 7, 2010, at 3:38 PM, Alexandre Bergel wrote:
Hi!
Here is a short script excerpt I use. view shape rectangle size: 10; fillColor: [ :aMethod | aMethod isCovered ifTrue: [ Color lightRed ] ifFalse: [ Color white ]]. view nodes: (aClass methods sortedAs: #isCovered).
I feel the way the color is set is very verbose. The following are equivalent fillColor: { #isCovered -> #lightRed } fillColor: { [:m | m isCovered] -> #lightRed } fillColor: { #isCovered -> #lightRed . [:m | m isCovered not ] - > #white}
The white color could be the default color is no color is picked up.
In the script above, I also use #sortedAs: to sort my elements. I find this method quite handy. It is defined as an extension of Collection. It is more flexible than Jannik's #sortedBy: and Moose's #sorted:. #sortedAs operates on boolean as well.
Any opinion?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"It's not how it is, it is how we see it."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"We are all great at making mistakes."