doc: misc proofread
[nit.git] / src / metrics / mclassdef_collect.nit
index 84537ce..2c8f1c5 100644 (file)
 module mclassdef_collect
 
 # We usualy need specific phases
-# NOTE: `frontend` is sufficent in most case (it is often too much)
+# NOTE: `frontend` is sufficent in most cases (it is often too much)
 import frontend
-import model_views
 import model_collect
 
 redef class MClassDef
        # Collect all mproperties introduced in 'self' with `visibility >= min_visibility`.
-       fun collect_intro_mproperties(view: ModelView): Set[MProperty] do
+       fun collect_intro_mproperties(filter: ModelFilter): Set[MProperty] do
                var set = new HashSet[MProperty]
                        for mprop in self.intro_mproperties do
-                               if not view.accept_mentity(mprop) then continue
+                               if not filter.accept_mentity(mprop) then continue
                                set.add(mprop)
                        end
                return set
        end
 
        # Collect mmethods introduced in 'self' with `visibility >= min_visibility`.
-       fun collect_intro_mmethods(view: ModelView): Set[MMethod] do
+       fun collect_intro_mmethods(filter: ModelFilter): Set[MMethod] do
                var res = new HashSet[MMethod]
-               for mproperty in collect_intro_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_intro_mproperties(filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MMethod then res.add(mproperty)
                end
                return res
        end
 
        # Collect mmethods redefined in 'self' with `visibility >= min_visibility`.
-       fun collect_redef_mmethods(view: ModelView): Set[MMethod] do
+       fun collect_redef_mmethods(filter: ModelFilter): Set[MMethod] do
                var res = new HashSet[MMethod]
-               for mproperty in collect_redef_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_redef_mproperties(filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MMethod then res.add(mproperty)
                end
                return res
        end
 
        # Collect mattributes redefined in 'self' with `visibility >= min_visibility`.
-       fun collect_redef_mattributes(view: ModelView): Set[MAttribute] do
+       fun collect_redef_mattributes(filter: ModelFilter): Set[MAttribute] do
                var res = new HashSet[MAttribute]
-               for mproperty in collect_redef_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_redef_mproperties(filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MAttribute then res.add(mproperty)
                end
                return res
        end
 
        # Collect mattributes introduced in 'self' with `visibility >= min_visibility`.
-       fun collect_intro_mattributes(view: ModelView): Set[MAttribute] do
+       fun collect_intro_mattributes(filter: ModelFilter): Set[MAttribute] do
                var res = new HashSet[MAttribute]
-               for mproperty in collect_intro_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_intro_mproperties(filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MAttribute then res.add(mproperty)
                end
                return res
        end
 
        # Collect all mproperties redefined in 'self' with `visibility >= min_visibility`.
-       fun collect_redef_mproperties(view: ModelView): Set[MProperty] do
+       fun collect_redef_mproperties(filter: ModelFilter): Set[MProperty] do
                var set = new HashSet[MProperty]
                for mpropdef in self.mpropdefs do
-                       if not view.accept_mentity(mpropdef) then continue
+                       if not filter.accept_mentity(mpropdef) then continue
                        if mpropdef.mproperty.intro_mclassdef.mclass == self then continue
                                set.add(mpropdef.mproperty)
                        end
                return set
        end
 
-       # Collect mmethods inherited by 'self' if accepted by `view`.
-       fun collect_inherited_mmethods(view: ModelView): Set[MMethod] do
+       # Collect mmethods inherited by 'self' if accepted by `filter`.
+       fun collect_inherited_mmethods(mainmodule: MModule, filter: ModelFilter): Set[MMethod] do
                var res = new HashSet[MMethod]
-               for mproperty in collect_inherited_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_inherited_mproperties(mainmodule, filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MMethod then res.add(mproperty)
                end
                return res
        end
 
        # Collect mproperties introduced and redefined in 'self' with `visibility >= min_visibility`.
-       fun collect_local_mproperties(view: ModelView): Set[MProperty] do
+       fun collect_local_mproperties(filter: ModelFilter): Set[MProperty] do
                var set = new HashSet[MProperty]
-               set.add_all collect_intro_mproperties(view)
-               set.add_all collect_redef_mproperties(view)
+               set.add_all collect_intro_mproperties(filter)
+               set.add_all collect_redef_mproperties(filter)
                return set
        end
 
        # Collect all mproperties inehrited by 'self' with `visibility >= min_visibility`.
-       fun collect_inherited_mproperties(view: ModelView): Set[MProperty] do
+       fun collect_inherited_mproperties(mainmodule: MModule, filter: ModelFilter): Set[MProperty] do
                var set = new HashSet[MProperty]
-               for parent in collect_parents(view) do
-                       set.add_all(parent.collect_intro_mproperties(view))
-                       set.add_all(parent.collect_inherited_mproperties(view))
+               for parent in collect_parents(mainmodule, filter) do
+                       set.add_all(parent.collect_intro_mproperties(filter))
+                       set.add_all(parent.collect_inherited_mproperties(mainmodule, filter))
                end
                return set
        end
 
        # Collect mattributes inherited by 'self' with `visibility >= min_visibility`.
-       fun collect_inherited_mattributes(view: ModelView): Set[MAttribute] do
+       fun collect_inherited_mattributes(mainmodule: MModule, filter: ModelFilter): Set[MAttribute] do
                var res = new HashSet[MAttribute]
-               for mproperty in collect_inherited_mproperties(view) do
-                       if not view.accept_mentity(mproperty) then continue
+               for mproperty in collect_inherited_mproperties(mainmodule, filter) do
+                       if not filter.accept_mentity(mproperty) then continue
                        if mproperty isa MAttribute then res.add(mproperty)
                end
                return res
        end
 
        # Collect all mmethod inehrited,intro and redef
-       fun collect_all_methods(view: ModelView): Set[MMethod] do
+       fun collect_all_methods(mainmodule: MModule, filter: ModelFilter): Set[MMethod] do
                var set = new HashSet[MMethod]
-               set.add_all collect_intro_mmethods(view)
-               set.add_all collect_redef_mmethods(view)
-               set.add_all collect_inherited_mmethods(view)
+               set.add_all collect_intro_mmethods(filter)
+               set.add_all collect_redef_mmethods(filter)
+               set.add_all collect_inherited_mmethods(mainmodule, filter)
                return set
        end
 
        # Collect all mattributs inehrited,intro and redef
-       fun collect_all_mattributes(view: ModelView): Set[MAttribute] do
+       fun collect_all_mattributes(mainmodule: MModule, filter: ModelFilter): Set[MAttribute] do
                var set = new HashSet[MAttribute]
-               set.add_all collect_redef_mattributes(view)
-               set.add_all collect_intro_mattributes(view)
-               set.add_all collect_inherited_mattributes(view)
+               set.add_all collect_redef_mattributes(filter)
+               set.add_all collect_intro_mattributes(filter)
+               set.add_all collect_inherited_mattributes(mainmodule, filter)
                return set
        end
 
        # Collect intro and redef mmethods
-       fun collect_intro_and_redef_methods(view: ModelView): Set[MMethod] do
+       fun collect_intro_and_redef_methods(filter: ModelFilter): Set[MMethod] do
                var set = new HashSet[MMethod]
-               set.add_all collect_intro_mmethods(view)
-               set.add_all collect_redef_mmethods(view)
+               set.add_all collect_intro_mmethods(filter)
+               set.add_all collect_redef_mmethods(filter)
                return set
        end
 
        # Collect intro and redef mattributs
-       fun collect_intro_and_redef_mattributes(view: ModelView): Set[MAttribute] do
+       fun collect_intro_and_redef_mattributes(filter: ModelFilter): Set[MAttribute] do
                var set = new HashSet[MAttribute]
-               set.add_all collect_redef_mattributes(view)
-               set.add_all collect_intro_mattributes(view)
+               set.add_all collect_redef_mattributes(filter)
+               set.add_all collect_intro_mattributes(filter)
                return set
        end
 
        # Collect intro and redef mpropdefs
-       fun collect_intro_and_redef_mpropdefs(view: ModelView): Set[MPropDef] do
+       fun collect_intro_and_redef_mpropdefs(filter: ModelFilter): Set[MPropDef] do
                var set = new HashSet[MPropDef]
-               set.add_all collect_intro_mpropdefs(view)
-               set.add_all collect_redef_mpropdefs(view)
+               set.add_all collect_intro_mpropdefs(filter)
+               set.add_all collect_redef_mpropdefs(filter)
                return set
        end
 
        # Collect intro abstract mmethodDef
-       fun collect_abstract_methods(view: ModelView): Set[MMethodDef] do
+       fun collect_abstract_methods(filter: ModelFilter): Set[MMethodDef] do
                var set = new HashSet[MMethodDef]
-               var mpropdefs = collect_intro_mpropdefs(view)
+               var mpropdefs = collect_intro_mpropdefs(filter)
                for mpropdef in mpropdefs do
                        if mpropdef isa MMethodDef then
                                if mpropdef.is_abstract then set.add(mpropdef)
@@ -176,9 +175,9 @@ redef class MClassDef
        end
 
        # Collect not defined properties
-       fun collect_not_define_properties(view: ModelView):Set[MMethodDef] do
+       fun collect_not_define_properties(filter: ModelFilter):Set[MMethodDef] do
                var set = new HashSet[MMethodDef]
-               for mpropdef in collect_abstract_methods(view) do
+               for mpropdef in collect_abstract_methods(filter) do
                        var redef_count = 0
                        for mprop in mpropdef.mproperty.mpropdefs do
                                if mprop.is_abstract then continue