For a simple user of the model, the classdef hierarchy is not really usefull, it is more an internal thing.
# Create a dot file representing the classdef hierarchy of a model.
# For a simple user of the model, the classdef hierarchy is not really usefull, it is more an internal thing.
fun generate_classdef_hierarchy(toolcontext: ToolContext, model: Model)
do
var buf = new FlatBuffer
buf.append("digraph \{\n")
buf.append("node [shape=box];\n")
buf.append("rankdir=BT;\n")
for mmodule in model.mmodules do
for mclassdef in mmodule.mclassdefs do
buf.append("\"{mclassdef} {mclassdef.bound_mtype}\" [label=\"{mclassdef.mmodule}\\n{mclassdef.bound_mtype}\"];\n")
for s in mclassdef.in_hierarchy.direct_greaters do
buf.append("\"{mclassdef} {mclassdef.bound_mtype}\" -> \"{s} {s.bound_mtype}\";\n")
end
end
end
buf.append("\}\n")
var f = new FileWriter.open(toolcontext.output_dir.join_path("classdef_hierarchy.dot"))
f.write(buf.to_s)
f.close
end
src/metrics/generate_hierarchies.nit:85,1--105,3