+
+ redef fun collect_modifiers do return super + ["package"]
+
+ # Collect all packages directly imported by `self`
+ redef fun collect_parents(view) do
+ var res = new HashSet[MENTITY]
+ for mgroup in mgroups do
+ for parent in mgroup.collect_parents(view) do
+ var mpackage = parent.mpackage
+ if mpackage == self or not view.accept_mentity(mpackage) then continue
+ res.add(mpackage)
+ end
+ end
+ return res
+ end
+
+ # Collect all packages that directly depends on `self`
+ redef fun collect_children(view) do
+ var res = new HashSet[MENTITY]
+ for mpackage in view.mpackages do
+ if mpackage.collect_parents(view).has(self) then res.add mpackage
+ end
+ return res
+ end
+
+ # Collect all groups contained in `self`
+ fun collect_all_mgroups(view: ModelView): HashSet[MGroup] do
+ var res = new HashSet[MGroup]
+ for mgroup in mgroups do
+ if not view.accept_mentity(mgroup) then continue
+ res.add(mgroup)
+ end
+ return res
+ end
+
+ # Collect only groups contained in `self.root`
+ fun collect_mgroups(view: ModelView): HashSet[MGroup] do
+ var res = new HashSet[MGroup]
+ var root = self.root
+ if root == null then return res
+ 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