[ENH] CategorizeUncategorizedMethods-nk

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Tue Feb 13 13:29:21 UTC 2001


ned at bike-nomad.com wrote:

> This menu choice will attempt to recategorize uncategorized
> methods by looking in parent classes for the method category.

Ingenious! I modified this and ran it on all classes in the 3.1a image,
resulting in 469 classified out of 2342 unclassified methods. Seems like a
good idea to run it on the entire 3.0 image before release.

Henrik

    | organizer organizers total count all |

    total _ 0.all _ 0.
    Smalltalk allClassesDo: [:class |
        count _ 0.
        organizer _ class organization.
        organizers _ class withAllSuperclasses collect: [ :ea | ea
organization ].
        all _ all + (organizer listAtCategoryNamed: ClassOrganizer default)
size.
        (organizer listAtCategoryNamed: ClassOrganizer default) do: [ :sel |
| found |
            found _ (organizers collect: [ :org | org categoryOfElement: sel
])
                detect: [ :ea | ea ~= ClassOrganizer default ]
                ifNone: [ ].
            found ifNotNil: [
                Transcript tab; nextPutAll: class name,'>>', sel,' -> ',
found;cr.
                count _ count + 1
                "organizer classify: sel under: found" ]
        ].
        count > 0 ifTrue: [
            Transcript show: class printString, ' ', count printString;cr.
            total _ total + count].
    ].
    Transcript show: 'total ', total printString, ' / '; show: all; space;
show: total/all asFloat; cr.






More information about the Squeak-dev mailing list