nitc :: MNVI :: defaultinit
# Module Novelty Index
# mnvi = |LocS(module)| / mbms(parents(module))
class MNVI
super MModuleMetric
super FloatMetric
redef fun name do return "mnvi"
redef fun desc do return "module novelty index, contribution of the module to its branch in term of introductions"
redef fun collect(mmodules) do
var mbms = new MBMS(model, mainmodule, filter)
for mmodule in mmodules do
# compute branch mean size
var parents = mmodule.in_importation.direct_greaters
if parents.length > 0 then
mbms.clear
mbms.collect(new HashSet[MModule].from(parents))
# compute module novelty index
var locc = mmodule.collect_intro_mclassdefs(filter).length
locc += mmodule.collect_redef_mclassdefs(filter).length
values[mmodule] = locc.to_f / mbms.avg
else
values[mmodule] = 0.0
end
end
end
end
src/metrics/mendel_metrics.nit:193,1--218,3