Hi!
I have been looking for a method that give me the depth of the class hierarchy under a particular class. Doru pointed me the method FAMIXClass>>maxHierarchyOfChildren. But I was not able to make it work.
I imported Morph into moose, and try to send #maxHierarchyOfChildren to the famix representation of Canvas or Morph. It simply loops.
#maxHierarchyOfChildren and its unique caller (#ahh) are not tested. I try to look at the implementation of maxHierarchyOfChildren, but it was a bit obscure to me (almost midnight here :) I decided to write my own:
-=-=-=-=-=-=-=-=-=-=-=-= FAMIXClass>>subclassHierarchyDepth <property: #SHD longName: 'Subclass hierarchy Depth' description: 'The depth of the class hierarchy for which I am the root'>
^ (self directSubclasses isEmpty or: [ self isStub ]) ifTrue: [ 0 ] ifFalse: [ | currentMaxDepth| currentMaxDepth := 0. self subclassesDo: [ :aClass | currentMaxDepth := currentMaxDepth max: aClass subclassHierarchyDepth ]. 1 + currentMaxDepth ] -=-=-=-=-=-=-=-=-=-=-=-=
Any one can comment on maxHierarchyOfChildren? Does it make sense to remove maxHierarchyOfChildren and add my subclassHierarchyDepth?
Cheers, Alexandre