uml: remove ModelView dependency
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 May 2018 01:48:34 +0000 (21:48 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 17 May 2018 21:16:29 +0000 (17:16 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/nituml.nit
src/uml/uml_base.nit
src/uml/uml_class.nit
src/uml/uml_module.nit

index 0b9bf72..2723a8b 100644 (file)
@@ -46,8 +46,7 @@ private class UMLPhase
                        filters.min_visibility = protected_visibility
                end
 
-               var view = new ModelView(mainmodule.model, mainmodule, filters)
-               var d = new UMLModel(view, mainmodule)
+               var d = new UMLModel(toolcontext.modelbuilder.model, mainmodule, filters)
                if toolcontext.opt_gen.value == 0 then
                        print d.generate_class_uml.write_to_string
                else if toolcontext.opt_gen.value == 1 then
index 2580d95..04538f0 100644 (file)
@@ -21,9 +21,12 @@ import model::model_collect
 # UML model builder.
 class UMLModel
 
-       # Model view
-       var view: ModelView
+       # Model to access mentities
+       var model: Model
 
        # Main module used for linearization.
        var mainmodule: MModule
+
+       # Filters to apply on model if any
+       var filter: nullable ModelFilter
 end
index ee7f360..5dfdfd1 100644 (file)
@@ -35,7 +35,7 @@ redef class UMLModel
                                        fontname = "Bitstream Vera Sans"
                                        fontsize = 8
                                ]\n"""
-               for mclass in view.mclasses do
+               for mclass in model.collect_mclasses(filter) do
                        tpl.add mclass.tpl_class(self)
                        tpl.add "\n"
                end
@@ -72,7 +72,7 @@ redef class MClass
                        t.add "]"
                end
                t.add "|"
-               var props = collect_intro_mproperties(model.view)
+               var props = collect_intro_mproperties(model.filter)
                for i in props do
                        if not i isa MAttribute then continue
                        t.add i.tpl_class(model)
@@ -87,7 +87,7 @@ redef class MClass
                t.add "\}\"\n]\n"
                var g = in_hierarchy(model.mainmodule).direct_greaters
                for i in g do
-                       if not model.view.accept_mentity(i) then continue
+                       if not model.filter.accept_mentity(i) then continue
                        t.add "{i.name} -> {name} [dir=back"
                        if i.kind == interface_kind then
                                t.add " arrowtail=open style=dashed"
index 19726ed..d8804e6 100644 (file)
@@ -52,7 +52,7 @@ redef class MModule
                t.add "subgraph cluster{name} \{\n"
                t.add "label = \"{name}\"\n"
                for i in mclassdefs do
-                       if not model.view.accept_mentity(i) then continue
+                       if not model.filter.accept_mentity(i) then continue
                        t.add i.tpl_module(model)
                end
                t.add "\}\n"
@@ -96,14 +96,14 @@ redef class MClassDef
                t.add "|"
                for i in mpropdefs do
                        if not i isa MAttributeDef then continue
-                       if not model.view.accept_mentity(i) then continue
+                       if not model.filter.accept_mentity(i) then continue
                        t.add i.tpl_module(model)
                        t.add "\\l"
                end
                t.add "|"
                for i in mpropdefs do
                        if not i isa MMethodDef then continue
-                       if not model.view.accept_mentity(i) then continue
+                       if not model.filter.accept_mentity(i) then continue
                        t.add i.tpl_module(model)
                        t.add "\\l"
                end