<commit_before>﻿// Version compatibility level: 3.1.0
namespace BoboBrowse.Net.Facets.Impl
{
    using BoboBrowse.Net.Support;
    using Common.Logging;
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;

    public class DynamicTimeRangeFacetHandler : DynamicRangeFacetHandler
    {
        private static ILog log = LogManager.GetLogger<DynamicTimeRangeFacetHandler>();
        public const string NUMBER_FORMAT = "00000000000000000000";

        public const long MILLIS_IN_DAY = 24L * 60L * 60L * 1000L;
        public const long MILLIS_IN_HOUR = 60L * 60L * 1000L;
        public const long MILLIS_IN_MIN = 60L * 1000L;
        public const long MILLIS_IN_SEC = 1000L;

        private readonly IDictionary<string, string> _valueToRangeStringMap;
        private readonly IDictionary<string, string> _rangeStringToValueMap;
        private readonly IList<string> _rangeStringList;

        public DynamicTimeRangeFacetHandler(string name, string dataFacetName, long currentTime, IEnumerable<string> ranges)
            : base(name, dataFacetName)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug(name + " " + dataFacetName + " " + currentTime);
            }
            List<string> sortedRanges = new List<string>(ranges);
            sortedRanges.Sort();

            _valueToRangeStringMap = new Dictionary<string, string>();
            _rangeStringToValueMap = new Dictionary<string, string>();
            _rangeStringList = new List<string>(ranges.Count());

            string prev = "000000000";
            foreach (string range in sortedRanges)
            {
                string rangeString = BuildRangeString(currentTime, prev, range);
                _valueToRangeStringMap.Put(range, rangeString);
                _rangeStringToValueMap.Put(rangeString, range);
                _rangeStringList.Add(rangeString);
                prev = range;

                if (log.IsDebugEnabled)<commit_msg>Added missing documentation to the DynamicTimeRangeFacetHandler.<commit_after>﻿// Version compatibility level: 3.1.0
namespace BoboBrowse.Net.Facets.Impl
{
    using BoboBrowse.Net.Support;
    using Common.Logging;
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;

    public class DynamicTimeRangeFacetHandler : DynamicRangeFacetHandler
    {
        private static ILog log = LogManager.GetLogger<DynamicTimeRangeFacetHandler>();
        public const string NUMBER_FORMAT = "00000000000000000000";

        public const long MILLIS_IN_DAY = 24L * 60L * 60L * 1000L;
        public const long MILLIS_IN_HOUR = 60L * 60L * 1000L;
        public const long MILLIS_IN_MIN = 60L * 1000L;
        public const long MILLIS_IN_SEC = 1000L;

        private readonly IDictionary<string, string> _valueToRangeStringMap;
        private readonly IDictionary<string, string> _rangeStringToValueMap;
        private readonly IList<string> _rangeStringList;

        /// <summary>
        /// the format of range string is dddhhmmss. (ddd: days (000-999), hh : hours (00-23), mm: minutes (00-59), ss: seconds (00-59))
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dataFacetName"></param>
        /// <param name="currentTime"></param>
        /// <param name="ranges"></param>
        public DynamicTimeRangeFacetHandler(string name, string dataFacetName, long currentTime, IEnumerable<string> ranges)
            : base(name, dataFacetName)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug(name + " " + dataFacetName + " " + currentTime);
            }
            List<string> sortedRanges = new List<string>(ranges);
            sortedRanges.Sort();

            _valueToRangeStringMap = new Dictionary<string, string>();
            _rangeStringToValueMap = new Dictionary<string, string>();
            _rangeStringList = new List<string>(ranges.Count());

            string prev = "000000000";
            foreach (string range in sortedRanges)
            {
                string rangeString = BuildRangeString(currentTime, prev, range);
                _valueToRangeStringMap.Put(range, rangeString);
                _rangeStringToValueMap.Put(rangeString, range);
                _rangeStringList.Add(rangeString);
                prev = range;

                if (log.IsDebugEnabled)
{'fraction_non_alphanumeric': 0.09026075328727434, 'fraction_numerical': 0.030755515934923112, 'mean_word_length': 2.5089913995308835, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '2141830', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1198, 'n_words': 291}