Ejemplo n.º 1
0
        private OddsPair GetPreviousPair(Dictionary <int, OddsPair> oddsPairDic, int currentKey)
        {
            OddsPair oddsPair = (OddsPair)null;

            if (currentKey - 1 < 0 || oddsPairDic.TryGetValue(currentKey - 1, out oddsPair))
            {
                return(oddsPair);
            }
            return(this.GetPreviousPair(oddsPairDic, currentKey - 1));
        }
Ejemplo n.º 2
0
        private OddsPair GetNextPair(Dictionary <int, OddsPair> oddsPairDic, int currentKey)
        {
            OddsPair oddsPair = (OddsPair)null;

            if (currentKey >= oddsPairDic.Count || oddsPairDic.TryGetValue(currentKey + 1, out oddsPair))
            {
                return(oddsPair);
            }
            return(this.GetNextPair(oddsPairDic, currentKey + 1));
        }
Ejemplo n.º 3
0
        private void RetrieveGraphedOdds(Dictionary <int, OddsPair> oddsPairDic)
        {
            Dictionary <int, OddsPair> dictionary = new Dictionary <int, OddsPair>();

            for (int index = 0; index < this._SplitDates.Count; ++index)
            {
                OddsPair oddsPair;
                if (!oddsPairDic.TryGetValue(index, out oddsPair))
                {
                    oddsPair = index != 0 ? this.GetPreviousPair(oddsPairDic, index) : this.GetNextPair(oddsPairDic, index);
                    if (oddsPair != null)
                    {
                        oddsPair.TimeRange = index;
                        oddsPairDic[index] = oddsPair;
                    }
                }
            }
            List <int> list1 = new List <int>();

            foreach (KeyValuePair <int, OddsPair> keyValuePair in oddsPairDic)
            {
                if (keyValuePair.Key == 0 || list1.Count == 0)
                {
                    list1 = Enumerable.ToList <int>(Enumerable.Select <OddsInfo, int>((IEnumerable <OddsInfo>)keyValuePair.Value.Last, (Func <OddsInfo, int>)(o => o.CompanyId)));
                    this.Calculate(this._SplitDates[keyValuePair.Key], (IEnumerable <OddsInfo>)keyValuePair.Value.Last, keyValuePair.Key + 1);
                }
                else
                {
                    Enumerable.ToList <OddsInfo>(Enumerable.Except <OddsInfo>((IEnumerable <OddsInfo>)keyValuePair.Value.Last, (IEnumerable <OddsInfo>)keyValuePair.Value.First));
                    List <int> list2     = Enumerable.ToList <int>(Enumerable.Select <OddsInfo, int>((IEnumerable <OddsInfo>)keyValuePair.Value.Last, (Func <OddsInfo, int>)(o => o.CompanyId)));
                    List <int> diffComps = Enumerable.ToList <int>(Enumerable.Except <int>((IEnumerable <int>)list1, (IEnumerable <int>)list2));
                    if (diffComps.Count > 0)
                    {
                        OddsPair previousPair = this.GetPreviousPair(oddsPairDic, keyValuePair.Key);
                        if (previousPair != null)
                        {
                            IEnumerable <OddsInfo> collection = Enumerable.Where <OddsInfo>((IEnumerable <OddsInfo>)previousPair.Last, (Func <OddsInfo, bool>)(o => diffComps.Contains(o.CompanyId)));
                            keyValuePair.Value.Last.AddRange(collection);
                            keyValuePair.Value.First.AddRange(collection);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    this.Calculate(this._SplitDates[keyValuePair.Key], (IEnumerable <OddsInfo>)keyValuePair.Value.Last, keyValuePair.Key + 1);
                    List <int> list3 = Enumerable.ToList <int>(Enumerable.Except <int>((IEnumerable <int>)list2, (IEnumerable <int>)list1));
                    list1.AddRange((IEnumerable <int>)list3);
                }
            }
        }