+ res.add_all root.collect_mgroups(view)
+ return res
+ end
+
+ # Collect all modules contained in `self`
+ fun collect_all_mmodules(view: ModelView): HashSet[MModule] do
+ var res = new HashSet[MModule]
+ for mgroup in collect_mgroups(view) do
+ res.add_all mgroup.collect_mmodules(view)
+ end
+ return res
+ end
+
+ # Collect only modules contained in `self.root`
+ fun collect_mmodules(view: ModelView): HashSet[MModule] do
+ var res = new HashSet[MModule]
+ var root = self.root
+ if root == null then return res
+ res.add_all root.collect_mmodules(view)
+ return res
+ end
+
+ # Collect all classes introduced in `self`
+ fun collect_intro_mclasses(view: ModelView): HashSet[MClass] do
+ var res = new HashSet[MClass]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_mclasses(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all classes redefined or refined in `self`
+ fun collect_redef_mclasses(view: ModelView): Set[MClass] do
+ var res = new HashSet[MClass]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_redef_mclasses(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all properties introduced in `self`
+ fun collect_intro_mproperties(view: ModelView): HashSet[MProperty] do
+ var res = new HashSet[MProperty]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_mproperties(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all properties redefined in `self`
+ fun collect_redef_mproperties(view: ModelView): HashSet[MProperty] do
+ var res = new HashSet[MProperty]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_redef_mproperties(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all attributes introduced in `self`
+ fun collect_intro_attributes(view: ModelView): Set[MAttribute] do
+ var res = new HashSet[MAttribute]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_attributes(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all inits introduced in `self`
+ fun collect_intro_inits(view: ModelView): Set[MMethod] do
+ var res = new HashSet[MMethod]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_inits(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all methods introduced in `self` excluding inits
+ #
+ # See `collect_intro_inits`.
+ fun collect_intro_methods(view: ModelView): Set[MMethod] do
+ var res = new HashSet[MMethod]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_methods(view)
+ end
+ end
+ return res
+ end
+
+ # Collect all virtual types introduced in `self`
+ fun collect_intro_vts(view: ModelView): Set[MVirtualTypeProp] do
+ var res = new HashSet[MVirtualTypeProp]
+ for mgroup in mgroups do
+ for mmodule in collect_all_mmodules(view) do
+ res.add_all mmodule.collect_intro_vts(view)
+ end
+ end