Hi Alex,
I do not see how you got a loop in the maxHierarchyOfChildren, but in any case the implementation was not good. I like yours much better.
Please remove the maxHierarchyOfChildren (I do not like the name either :)) and replace it with your method.
Cheers, Doru
On 26 Apr 2010, at 05:15, Alexandre Bergel wrote:
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
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Every now and then stop and ask yourself if the war you're fighting is the right one."