/// <summary> /// TLLOC and TLOC calculation /// </summary> private static void CalculateTotalLineMetrics() { Lim.Asg.Factory.Iterator it = MainDeclaration.Instance.LimFactory.getIterator(); while (it.hasNext()) { Lim.Asg.Nodes.Base.Base baseIt = it.getNext(); if (Lim.Asg.Common.getIsScope(baseIt)) { Lim.Asg.Nodes.Logical.Scope scope = baseIt as Lim.Asg.Nodes.Logical.Scope; scope.TLLOC = (uint)TLLOC.CollectTLLOC(ref scope); scope.SetLOC(); } if (Lim.Asg.Common.getIsComponent(baseIt)) { ulong tloc = 0; if (MainDeclaration.Instance.ComponentTLOCMap.ContainsKey(baseIt.Id)) { foreach (var itFileKeys in MainDeclaration.Instance.ComponentTLOCMap[baseIt.Id]) { tloc += itFileKeys.Value; } } (baseIt as Lim.Asg.Nodes.Base.Component).TLOC = (uint)tloc; } } }
/// <summary> /// Aggregate LLOC to the /// - File level /// - Scope level /// - Component level /// </summary> /// <returns></returns> private static Dictionary <uint, HashSet <uint> > GetFileLLOC() { Dictionary <uint, HashSet <uint> > fileLLOC = new Dictionary <uint, HashSet <uint> >(); foreach (var idIt in MainDeclaration.Instance.LLOCMap) { Lim.Asg.Nodes.Base.Base @ref = MainDeclaration.Instance.LimFactory.getRef(idIt.Key); // File var TLLOC_ofScope = idIt.Value; TLLOC.MergePathLineMaps(ref fileLLOC, ref TLLOC_ofScope); // Scope if (Lim.Asg.Common.getIsScope(@ref)) { Lim.Asg.Nodes.Logical.Scope scope = @ref as Lim.Asg.Nodes.Logical.Scope; foreach (var item in idIt.Value) { scope.LLOC += (uint)item.Value.Count; } } // Component else if (Lim.Asg.Common.getIsComponent(@ref)) { Lim.Asg.Nodes.Base.Component component = @ref as Lim.Asg.Nodes.Base.Component; foreach (var item in idIt.Value) { component.TLLOC += (uint)item.Value.Count; } } } return(fileLLOC); }