Le 31/01/2013 02:30, Stéphane Ducasse a écrit :
Morbid fascination
It is late so I may completely off but
how many isKindOf: are executed in this method?

((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == #openPath]]])

when  [aSymbol second == #openPath] is not openPath
then we go to the next (not mentioning duplicated code inside the method ---- I 
will vomit)
and we restart to execute isKindOf:

((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == 
#expandAllFromNode:]]])

Am'I right?
It looks so terrible.

It is. As a user of MorphTreeMorph, this stuff is hard to use (and doesn't work very well).

self history pauseDuring: [ self changed: #(#rootNodes #openItemPath) , nPath reverse ].

:(

It's also very well documented, of course.

Thierry

Stef



update: aSymbol
        aSymbol == #selection ifTrue: [^ self listManager 
updateSelectionFromModel].
        ((aSymbol  isKindOf: Array)     and: [aSymbol size > 1 and: [aSymbol 
first == #selectItems and: [aSymbol second isCollection]]])
                ifTrue: [^ self selectedItems: aSymbol second].
        aSymbol == self nodeListSelector ifTrue: [^ self updateList].
        aSymbol == #selectAll ifTrue: [^ self listManager selectAll].
        aSymbol == #deselectAll ifTrue: [^ self listManager deselectAll].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == #openPath]]]) "allow 
directed path opening where multiple trees exist"
                        ifTrue:
                                [^(self allNodeMorphs at: 1 ifAbsent: [^self])
                                        openPath: (aSymbol allButFirst: 2)].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == #openItemPath]]]) "allow 
directed path opening where multiple trees exist"
                        ifTrue:
                                [^ (self allNodeMorphs at: 1 ifAbsent: [^self])
                                        openItemPath: (aSymbol allButFirst: 2)].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == 
#expandAllFromNode:]]])
                        ifTrue:
                                [^ self expandAllFromNode: aSymbol third].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size > 1 and: [aSymbol first == self 
nodeListSelector and: [
                                        aSymbol second == #closeItemPath]]]) "allow 
directed path closing where multiple trees exist"
                        ifTrue:
                                [^ (self allNodeMorphs at: 1 ifAbsent: [^self])
                                        closeItemPath: (aSymbol allButFirst: 
2)].
        ((aSymbol isKindOf: Array)
                and: [aSymbol notEmpty and: [aSymbol first == #openPath]])
                        ifTrue:
                                [^(self allNodeMorphs at: 1 ifAbsent: [^self])
                                        openPath: aSymbol allButFirst].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size  = 2 and: [aSymbol first = self 
nodeListSelector and: [
                                        aSymbol second == #expandRoots]]])
                        ifTrue:
                                [^self expandRoots].
        ((aSymbol isKindOf: Array)
                and: [aSymbol size = 2 and: [aSymbol first = self 
nodeListSelector]])
                ifTrue: [aSymbol second = #expandAll ifTrue: [^ self expandAll].
                        aSymbol second = #collapseAll ifTrue: [^ self 
collapseAll]]





--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95

Reply via email to