+
+ # Collect all classes introduced and refined in `self`
+ fun collect_local_mclasses(view: ModelView): Set[MClass] do
+ var res = new HashSet[MClass]
+ res.add_all collect_intro_mclasses(view)
+ res.add_all collect_redef_mclasses(view)
+ return res
+ end
+
+ # Collect all classes imported from `self` parents
+ fun collect_imported_mclasses(view: ModelView): Set[MClass] do
+ var res = new HashSet[MClass]
+ for parent in collect_parents(view) do
+ res.add_all parent.collect_intro_mclasses(view)
+ res.add_all parent.collect_redef_mclasses(view)
+ res.add_all parent.collect_imported_mclasses(view)
+ end
+ return res
+ end
+
+ # Collect all properties introduced in `self`
+ fun collect_intro_mproperties(view: ModelView): Set[MProperty] do
+ var res = new HashSet[MProperty]
+ for mclass in collect_intro_mclasses(view) do
+ res.add_all mclass.collect_intro_mproperties(view)
+ end
+ return res
+ end
+
+ # Collect properties redefined in `self`
+ fun collect_redef_mproperties(view: ModelView): Set[MProperty] do
+ var res = new HashSet[MProperty]
+ for mclassdef in mclassdefs do
+ for mpropdef in mclassdef.collect_redef_mpropdefs(view) do
+ res.add mpropdef.mproperty
+ end
+ end
+ return res
+ end
+
+ # Collect attributes introduced in `self`
+ fun collect_intro_attributes(view: ModelView): Set[MAttribute] do
+ var res = new HashSet[MAttribute]
+ for mproperty in collect_intro_mproperties(view) do
+ if mproperty isa MAttribute then res.add(mproperty)
+ 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 mproperty in collect_intro_mproperties(view) do
+ if mproperty isa MMethod and mproperty.is_init then res.add(mproperty)
+ end
+ return res
+ end
+
+ # Collect methods introduced in `self` (without inits)
+ fun collect_intro_methods(view: ModelView): Set[MMethod] do
+ var res = new HashSet[MMethod]
+ for mproperty in collect_intro_mproperties(view) do
+ if mproperty isa MMethod and not mproperty.is_init then res.add(mproperty)
+ end
+ return res
+ end
+
+ # Collect virtual types introduced in `self`
+ fun collect_intro_vts(view: ModelView): Set[MVirtualTypeProp] do
+ var res = new HashSet[MVirtualTypeProp]
+ for mproperty in collect_intro_mproperties(view) do
+ if mproperty isa MVirtualTypeProp then res.add(mproperty)
+ end
+ return res
+ end