lib/serialization: add README.md
[nit.git] / src / metrics / generate_hierarchies.nit
index 7a85a5d..6193b9c 100644 (file)
 # See graphviz http://www.graphviz.org/
 module generate_hierarchies
 
-import model
-private import metrics_base
-import frontend
-import model_viz
+import metrics_base
+import model::model_viz
 
 redef class ToolContext
        var generate_hierarchies_phase: Phase = new GenerateHierarchyPhase(self, null)
@@ -55,19 +53,19 @@ do
                dot.mprojects.add(g.mproject)
        end
        var projectpath = toolcontext.output_dir.join_path("project_hierarchy.dot")
-       print "generating {projectpath}"
+       print "generating project_hierarchy.dot"
        dot.write_to_file(projectpath)
 
        var modulepath = toolcontext.output_dir.join_path("module_hierarchy.dot")
        dot.mprojects.add_all(model.mprojects)
-       print "generating {modulepath}"
+       print "generating module_hierarchy.dot"
        dot.write_to_file(modulepath)
 end
 
 # Create a dot file representing the class hierarchy of a model.
 fun generate_class_hierarchy(toolcontext: ToolContext, mmodule: MModule)
 do
-       var buf = new Buffer
+       var buf = new FlatBuffer
        buf.append("digraph \{\n")
        buf.append("node [shape=box];\n")
        buf.append("rankdir=BT;\n")
@@ -79,7 +77,7 @@ do
                end
        end
        buf.append("\}\n")
-       var f = new OFStream.open(toolcontext.output_dir.join_path("class_hierarchy.dot"))
+       var f = new FileWriter.open(toolcontext.output_dir.join_path("class_hierarchy.dot"))
        f.write(buf.to_s)
        f.close
 end
@@ -88,7 +86,7 @@ end
 # 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 Buffer
+       var buf = new FlatBuffer
        buf.append("digraph \{\n")
        buf.append("node [shape=box];\n")
        buf.append("rankdir=BT;\n")
@@ -101,7 +99,7 @@ do
                end
        end
        buf.append("\}\n")
-       var f = new OFStream.open(toolcontext.output_dir.join_path("classdef_hierarchy.dot"))
+       var f = new FileWriter.open(toolcontext.output_dir.join_path("classdef_hierarchy.dot"))
        f.write(buf.to_s)
        f.close
 end