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(a)iam.unibe.ch
>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch