ArchiMetrics.Analysis.Metrics.ProjectMetric.ProjectMetric C# (CSharp) Method

ProjectMetric() public method

public ProjectMetric ( string name, IEnumerable namespaceMetrics, IEnumerable referencedProjects, double relationalCohesion ) : System.Collections.Generic
name string
namespaceMetrics IEnumerable
referencedProjects IEnumerable
relationalCohesion double
return System.Collections.Generic
		public ProjectMetric(string name, IEnumerable<INamespaceMetric> namespaceMetrics, IEnumerable<string> referencedProjects, double relationalCohesion)
		{
			Name = name;
			RelationalCohesion = relationalCohesion;
			Dependencies = referencedProjects.AsArray();
			EfferentCoupling = Dependencies.Count();
			NamespaceMetrics = namespaceMetrics.AsArray();
			LinesOfCode = NamespaceMetrics.Sum(x => x.LinesOfCode);
			MaintainabilityIndex = LinesOfCode == 0 ? 100 : NamespaceMetrics.Sum(x => x.MaintainabilityIndex * x.LinesOfCode) / LinesOfCode;
			CyclomaticComplexity = LinesOfCode == 0 ? 0 : NamespaceMetrics.Sum(x => x.CyclomaticComplexity * x.LinesOfCode) / LinesOfCode;
			ClassCouplings = NamespaceMetrics.SelectMany(x => x.ClassCouplings).Where(x => x.Assembly != Name).Distinct(Comparer).AsArray();
			Dependendants = ClassCouplings.Select(x => x.Assembly)
				.Distinct()
				.AsArray();
			AfferentCoupling = Dependendants.Count();
			var typeMetrics = NamespaceMetrics.SelectMany(x => x.TypeMetrics).AsArray();
			Abstractness = typeMetrics.Count(x => x.IsAbstract) / (double)typeMetrics.Count();
		}
ProjectMetric