public TypeMetric( bool isAbstract, TypeMetricKind kind, AccessModifierKind accessModifier, IEnumerable<IMemberMetric> memberMetrics, int linesOfCode, int cyclomaticComplexity, double maintainabilityIndex, int depthOfInheritance, IEnumerable<ITypeCoupling> classCouplings, string name, int afferentCoupling, int efferentCoupling, double instability, ITypeDocumentation documentation) { IsAbstract = isAbstract; Kind = kind; AccessModifier = accessModifier; MemberMetrics = memberMetrics; LinesOfCode = linesOfCode; CyclomaticComplexity = cyclomaticComplexity; MaintainabilityIndex = maintainabilityIndex; DepthOfInheritance = depthOfInheritance; ClassCouplings = classCouplings.AsArray(); Name = name; AfferentCoupling = afferentCoupling; EfferentCoupling = efferentCoupling; Instability = instability; Documentation = documentation; }
public TypeMetric( bool isAbstract, TypeMetricKind kind, AccessModifierKind accessModifier, IEnumerable <IMemberMetric> memberMetrics, int linesOfCode, int sourceLinesOfCode, int cyclomaticComplexity, double maintainabilityIndex, int depthOfInheritance, IEnumerable <ITypeCoupling> classCouplings, string name, int afferentCoupling, int efferentCoupling, double instability, ITypeDocumentation documentation) { IsAbstract = isAbstract; Kind = kind; AccessModifier = accessModifier; MemberMetrics = memberMetrics.AsArray(); LinesOfCode = linesOfCode; SourceLinesOfCode = sourceLinesOfCode; CyclomaticComplexity = cyclomaticComplexity; MaintainabilityIndex = maintainabilityIndex; DepthOfInheritance = depthOfInheritance; Dependencies = classCouplings.AsArray(); Name = name; AfferentCoupling = afferentCoupling; EfferentCoupling = efferentCoupling; Instability = instability; Documentation = documentation; }
public TypeMetric CalculateFrom(TypeDeclarationSyntaxInfo typeNode, MemberMetrics memberMetrics) { TypeDeclarationSyntax syntax = (TypeDeclarationSyntax)typeNode.Syntax; TypeMetricKind metricKind = TypeMetricsCalculator.GetMetricKind(syntax); LcomMetrics lcomMetric = this.CalculateLackOfCohesion(syntax); TypeMetric typeMetric = new TypeMetric() { Name = TypeMetricsCalculator.GetDisplayName(syntax), Kind = metricKind, MemberMetrics = memberMetrics }; List <MetricResult> metricResults = new List <MetricResult>(); foreach (MetricCalculator calculator in calculators) { typeMetric.AddMetricResult(calculator.Calculate <MemberMetrics, MemberMetric>(memberMetrics)); } typeMetric.AddMetricResult(new MetricResult() { Name = MetricNames.LackOfCohesionOfMethods, Value = lcomMetric.Lcom }); typeMetric.AddMetricResult(new MetricResult() { Name = MetricNames.LackOfCohesionOfMethodsHendersonSellers, Value = lcomMetric.LcomHendersonSellers }); typeMetric.AddMetricResult(new MetricResult() { Name = MetricNames.NumberOfFields, Value = lcomMetric.NumFields }); typeMetric.AddMetricResult(new MetricResult() { Name = MetricNames.NumberOfMethods, Value = lcomMetric.NumMethods }); return(typeMetric); }