Inheritance: IHalsteadMetrics
Example #1
0
		public void VisitBlock(BlockSyntax node)
		{
			var tokens = node.DescendantTokens().ToList();
			var dictionary = ParseTokens(tokens, Operands.All);
			var dictionary2 = ParseTokens(tokens, Operators.All);
			var metrics = new HalsteadMetrics(
				numOperands: dictionary.Values.Sum(x => x.Count), 
				numUniqueOperands: dictionary.Values.SelectMany(x => x).Distinct().Count(), 
				numOperators: dictionary2.Values.Sum(x => x.Count), 
				numUniqueOperators: dictionary2.Values.SelectMany(x => x).Distinct().Count());
			_metrics = metrics;
		}
        public void VisitBlock(BlockSyntax node)
        {
            var tokens      = node.DescendantTokens().ToList();
            var dictionary  = ParseTokens(tokens, Operands.All);
            var dictionary2 = ParseTokens(tokens, Operators.All);
            var metrics     = new HalsteadMetrics(
                numOperands: dictionary.Values.Sum(x => x.Count),
                numUniqueOperands: dictionary.Values.SelectMany(x => x).Distinct().Count(),
                numOperators: dictionary2.Values.Sum(x => x.Count),
                numUniqueOperators: dictionary2.Values.SelectMany(x => x).Distinct().Count());

            _metrics = metrics;
        }