core :: Sys :: generate_class_hierarchy
# Create a dot file representing the class hierarchy of a model.
fun generate_class_hierarchy(toolcontext: ToolContext, mmodule: MModule)
do
var buf = new FlatBuffer
buf.append("digraph \{\n")
buf.append("node [shape=box];\n")
buf.append("rankdir=BT;\n")
var hierarchy = mmodule.flatten_mclass_hierarchy
for mclass in hierarchy do
buf.append("\"{mclass}\" [label=\"{mclass}\"];\n")
for s in hierarchy[mclass].direct_greaters do
buf.append("\"{mclass}\" -> \"{s}\";\n")
end
end
buf.append("\}\n")
var f = new FileWriter.open(toolcontext.output_dir.join_path("class_hierarchy.dot"))
f.write(buf.to_s)
f.close
end
src/metrics/generate_hierarchies.nit:65,1--83,3