/// <summary>
        ///     解析因子在记录中的连续次数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static List <FactorTrendAnalyseResult <T> > AnalyseConsecutives <T>(MultiNumberFactorTrendAnalyseDto <T> dto)
        {
            var resultList = new List <FactorTrendAnalyseResult <T> >();

            foreach (var factor in dto.Factors)
            {
                var curDto = new MultiNumberAnalyseConsecutiveDto <T>
                {
                    Numbers             = dto.Numbers,
                    MultiNumberMaxCount = dto.MultiNumberMaxCount,
                    AllowMaxInterval    = dto.AllowMaxInterval,
                    AllowMinTimes       = dto.AllowMinTimes,
                    AllowMinFactorCurrentConsecutiveTimes = dto.AllowMinFactorCurrentConsecutiveTimes,
                    NumbersTailCutCount           = dto.NumbersTailCutCount,
                    AnalyseConsecutiveCompareFunc = dto.AnalyseConsecutiveCompareFunc
                };

                if (factor.Left != null && factor.Left.Count > 0)
                {
                    curDto.Factor           = factor.Left;
                    curDto.PredictiveFactor = factor.Right;
                    resultList.Add(AnalyseConsecutive(curDto));
                }
                if (factor.Right != null && factor.Right.Count > 0)
                {
                    curDto.Factor           = factor.Right;
                    curDto.PredictiveFactor = factor.Left;
                    resultList.Add(AnalyseConsecutive(curDto));
                }
            }
            return(resultList);
        }
        /// <summary>
        ///     解析连续在因子中的记录数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dto"></param>
        /// <returns></returns>
        private static FactorTrendAnalyseResult <T> AnalyseConsecutive <T>(MultiNumberAnalyseConsecutiveDto <T> dto)
        {
            var curResult = new FactorTrendAnalyseResult <T>
            {
                Factor                     = dto.Factor,
                PredictiveFactor           = dto.PredictiveFactor,
                HistoricalConsecutiveTimes = new SortedDictionary <int, int>()
            };
            var i = dto.MultiNumberMaxCount;

            //连续次数
            var times  = 0;
            var length = dto.Numbers.Count - dto.NumbersTailCutCount;

            while (i < length)
            {
                if (dto.AnalyseConsecutiveCompareFunc(dto.Numbers, dto.Factor, i))
                {
                    times++;
                }
                else
                {
                    if (curResult.HistoricalConsecutiveTimes.ContainsKey(times))
                    {
                        curResult.HistoricalConsecutiveTimes[times]++;
                    }
                    else if (times >= dto.AllowMinTimes)
                    {
                        curResult.HistoricalConsecutiveTimes.Add(times, 1);
                    }
                    times = 0;
                }
                i++;
            }
            if (curResult.HistoricalConsecutiveTimes.ContainsKey(times))
            {
                curResult.HistoricalConsecutiveTimes[times]++;
            }
            else if (times >= dto.AllowMinTimes)
            {
                curResult.HistoricalConsecutiveTimes.Add(times, 1);
            }
            return(curResult);
        }