Пример #1
0
        public override bool Equals(object obj)
        {
            InheritanceNode testObj = obj as InheritanceNode;

            return(testObj.classDecl == this.classDecl &&
                   testObj.subClasses.SequenceEqual(this.subClasses));
        }
Пример #2
0
        // returns the InheritanceTree for a given method
        public InheritanceTree GetInheritanceTree(MethodDeclarationSyntax method)
        {
            InheritanceNode rootClass = new InheritanceNode(GetClass(method));

            InheritanceNode tree = CreateSubTree(rootClass, method);

            return(new InheritanceTree(method, rootClass));
        }
Пример #3
0
        // recoursivly creates an inheritance tree for a given method and it's given base class
        public InheritanceNode CreateSubTree(InheritanceNode tree, MethodDeclarationSyntax method)
        {
            ClassDeclarationSyntax        baseClass = tree.GetBaseClass();
            List <ClassDeclarationSyntax> methodInheritedClasses = GetDirectDerivedClasses(baseClass).Where(c => !ClassOverridesOrHidesMethod(c, method)).ToList();

            tree.SetSubClasses(methodInheritedClasses.Select(c => new InheritanceNode(c)).ToList());

            foreach (var subClass in tree.GetSubClasses())
            {
                CreateSubTree(subClass, method);
            }

            return(tree);
        }
Пример #4
0
 public InheritanceTree(MethodDeclarationSyntax method, InheritanceNode rootClass)
 {
     this.method    = method;
     this.rootClass = rootClass;
 }