// helper functions: // ================= // helper to convert the recoursive inheritance tree to a flattened graph private InheritanceGraph Tree2Graph(InheritanceGraph graph, InheritanceNode tree, IHNode groupNode, IHNode baseTypeNode) { ClassDeclarationSyntax classDecl = tree.GetBaseClass(); string nodeName = codeAnalysis.GetClassId(classDecl); // add the type node IHNode typeNode = new IHNode(groupNode.Id + ":" + nodeName, nodeName, classDecl, !codeAnalysis.IsClassAbstract(classDecl)); graph.AddNode(typeNode); // link the type node to the method group graph.AddLink(new IHLink(groupNode.Id, typeNode.Id, true)); // link the type node to it's base type if it has one if (baseTypeNode != null) { graph.AddLink(new IHLink(typeNode.Id, baseTypeNode.Id, false)); } foreach (var subClass in tree.GetSubClasses()) { graph = Tree2Graph(graph, subClass, groupNode, typeNode); } return(graph); }