<commit_before>﻿using System;

namespace Parser.Common.Html.Svg
{
    public class ProgressPartialCircleSvgPathStringProvider : IProgressPartialCircleSvgPathStringProvider
    {
        public string GetPathString(double value, double maximum, double radius, double svgSize)
        {
            var centerPoint = svgSize / 2;

            var alpha = 360 / maximum * value;
            var a = (90 - alpha) * Math.PI / 180;<commit_msg>added memorization to ProgressPartialCircleSvgPathStringProvider<commit_after>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace Parser.Common.Html.Svg
{
    public class ProgressPartialCircleSvgPathStringProvider : IProgressPartialCircleSvgPathStringProvider
    {
        private readonly IDictionary<int, string> memorizedSvgStringsByRoundedPercentage;

        public ProgressPartialCircleSvgPathStringProvider()
        {
            this.memorizedSvgStringsByRoundedPercentage = new ConcurrentDictionary<int, string>();
        }

        public string GetPathString(double value, double maximum, double radius, double svgSize)
        {
            var roundedPercentageValue = (int)(value / maximum * 100);
            if (!this.memorizedSvgStringsByRoundedPercentage.ContainsKey(roundedPercentageValue))
            {
                var path = this.GenerateSvgPathString(value, maximum, radius, svgSize);
                this.memorizedSvgStringsByRoundedPercentage.Add(roundedPercentageValue, path);
            }

            return this.memorizedSvgStringsByRoundedPercentage[roundedPercentageValue];
        }

        private string GenerateSvgPathString(double value, double maximum, double radius, double svgSize)
        {
            var centerPoint = svgSize / 2;

            var alpha = 360 / maximum * value;
            var a = (90 - alpha) * Math.PI / 180;
{'fraction_non_alphanumeric': 0.06870638754696726, 'fraction_numerical': 0.011272141706924315, 'mean_word_length': 3.025917926565875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4558409', 'n_tokens_mistral': 511, 'n_tokens_neox': 479, 'n_words': 110}