The Trunk: System-bf.411.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-bf.411.mcz

commits-2
Bert Freudenberg uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-bf.411.mcz

==================== Summary ====================

Name: System-bf.411
Author: bf
Time: 11 January 2011, 3:08:35.095 pm
UUID: 64b24272-ea53-45f6-878c-d147e8115fe5
Ancestors: System-cmm.410

Make SystemDictionary>>classAndTraitNames work if there are no traits (such as after unloadAllKnownPackages).

=============== Diff against System-cmm.410 ===============

Item was changed:
  ----- Method: SystemDictionary>>classAndTraitNames (in category 'classes and traits') -----
  classAndTraitNames
  "Answer a sorted collection of all class and trait (not including class-traits) names. The performance of this algorithm is O(n) if the classNames are already cached, otherwise O(n*log(n)) where n is self size."
 
  | classNames traitNames result temporary |
  classNames := self classNames.
  traitNames := self traitNames.
+ traitNames ifEmpty: [^classNames].
  temporary := Array new: classNames size + traitNames size.
  result := temporary shallowCopy.
  temporary
  replaceFrom: 1
  to: classNames size
  with: classNames
  startingAt: 1;
  replaceFrom: classNames size + 1
  to: temporary size
  with: traitNames
  startingAt: 1;
  mergeFirst: 1
  middle: classNames size
  last: temporary size
  into: result
  by: nil.
  ^result!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-bf.411.mcz

Levente Uzonyi-2
On Tue, 11 Jan 2011, [hidden email] wrote:

> Bert Freudenberg uploaded a new version of System to project The Trunk:
> http://source.squeak.org/trunk/System-bf.411.mcz
>
> ==================== Summary ====================
>
> Name: System-bf.411
> Author: bf
> Time: 11 January 2011, 3:08:35.095 pm
> UUID: 64b24272-ea53-45f6-878c-d147e8115fe5
> Ancestors: System-cmm.410
>
> Make SystemDictionary>>classAndTraitNames work if there are no traits (such as after unloadAllKnownPackages).

Nice find.


Levente

>
> =============== Diff against System-cmm.410 ===============
>
> Item was changed:
>  ----- Method: SystemDictionary>>classAndTraitNames (in category 'classes and traits') -----
>  classAndTraitNames
>   "Answer a sorted collection of all class and trait (not including class-traits) names. The performance of this algorithm is O(n) if the classNames are already cached, otherwise O(n*log(n)) where n is self size."
>
>   | classNames traitNames result temporary |
>   classNames := self classNames.
>   traitNames := self traitNames.
> + traitNames ifEmpty: [^classNames].
>   temporary := Array new: classNames size + traitNames size.
>   result := temporary shallowCopy.
>   temporary
>   replaceFrom: 1
>   to: classNames size
>   with: classNames
>   startingAt: 1;
>   replaceFrom: classNames size + 1
>   to: temporary size
>   with: traitNames
>   startingAt: 1;
>   mergeFirst: 1
>   middle: classNames size
>   last: temporary size
>   into: result
>   by: nil.
>   ^result!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-bf.411.mcz

Bert Freudenberg

On 11.01.2011, at 15:46, Levente Uzonyi wrote:

> On Tue, 11 Jan 2011, [hidden email] wrote:
>
>> Bert Freudenberg uploaded a new version of System to project The Trunk:
>> http://source.squeak.org/trunk/System-bf.411.mcz
>>
>> ==================== Summary ====================
>>
>> Name: System-bf.411
>> Author: bf
>> Time: 11 January 2011, 3:08:35.095 pm
>> UUID: 64b24272-ea53-45f6-878c-d147e8115fe5
>> Ancestors: System-cmm.410
>>
>> Make SystemDictionary>>classAndTraitNames work if there are no traits (such as after unloadAllKnownPackages).
>
> Nice find.
> Levente

Hehe. You *could* say the method is too cleverly optimized ;)

- Bert -

>>
>> =============== Diff against System-cmm.410 ===============
>>
>> Item was changed:
>> ----- Method: SystemDictionary>>classAndTraitNames (in category 'classes and traits') -----
>> classAndTraitNames
>> "Answer a sorted collection of all class and trait (not including class-traits) names. The performance of this algorithm is O(n) if the classNames are already cached, otherwise O(n*log(n)) where n is self size."
>>
>> | classNames traitNames result temporary |
>> classNames := self classNames.
>> traitNames := self traitNames.
>> + traitNames ifEmpty: [^classNames].
>> temporary := Array new: classNames size + traitNames size.
>> result := temporary shallowCopy.
>> temporary
>> replaceFrom: 1
>> to: classNames size
>> with: classNames
>> startingAt: 1;
>> replaceFrom: classNames size + 1
>> to: temporary size
>> with: traitNames
>> startingAt: 1;
>> mergeFirst: 1
>> middle: classNames size
>> last: temporary size
>> into: result
>> by: nil.
>> ^result!
>>
>>
>>
>