+end
+
+redef class MModule
+
+ private var nm: Int = 0 # (NC) Number of Modules
+ private var nc: Int = 0 # (NC) Number of Classes
+ private var ni: Int = 0 # (NI) Number of Interfaces
+ private var nac : Int = 0 # (NAC) Number of Abstract Classes
+ private var ngc : Int = 0 # (NGC) Number of Generic Classes
+ private var ngi : Int = 0 # (NGI) Number of Generic Interfaces
+
+ private var dit = "" # (DIT) Global Depth in Inheritance Tree
+ private var dui = "" # (DUI) Proportion of types that either implement an interface or extend another type other than Object
+ private var ccdui = "" # (CCDUI) Proportion of classes that extend some other class.
+ private var cidui = "" # (CIDUI) Proportion of classes that implement some other interface.
+ private var iidui = "" # (IIDUI) Proportion of interfaces that extend some other interface.
+ private var inhf = "" # (IF) Proportion of types Inherited From, that is, those types that are either extended or implemented
+ private var ccif = "" # (CCIF) Proportion of classes extended by some other class.
+ private var icif = "" # (ICIF) Proportion of interfaces implemented by some other class.
+ private var iiif = "" # (IIIF) Proportion of interfaces extended by some other interface.
+
+ private fun compute_module_inheritance_metrics(model: Model) do
+ var ditsum = 0
+ var dui_count = 0
+ var ccdui_count = 0
+ var cidui_count = 0
+ var iidui_count = 0
+ var if_count = 0
+ var ccif_count = 0
+ var icif_count = 0
+ var iiif_count = 0
+ var count = 0
+ for mmodule in self.in_nesting.greaters do
+ for mclass in mmodule.intro_mclasses do
+ count += 1
+ if mclass.is_class then nc += 1
+ if mclass.is_class and mclass.arity > 0 then ngc += 1
+ if mclass.is_class and mclass.is_abstract then nac += 1
+ if mclass.is_interface then ni += 1
+ if mclass.is_interface and mclass.arity > 0 then ngi += 1
+ ditsum += mclass.path_to_object.length
+ if mclass.is_dui_eligible then dui_count += 1
+ if mclass.is_ccdui_eligible then ccdui_count += 1
+ if mclass.is_cidui_eligible then cidui_count += 1
+ if mclass.is_iidui_eligible then iidui_count += 1
+ if mclass.is_if_eligible(model) then if_count += 1
+ if mclass.is_ccif_eligible(model) then ccif_count += 1
+ if mclass.is_icif_eligible(model) then icif_count += 1
+ if mclass.is_iiif_eligible(model) then iiif_count += 1
+ end
+ end