Exemplo n.º 1
0
        public void PutItem(LogItem m)
        {
            var filespec = m.Filespec;

            if (filespec != null &&
                !TheHt.ContainsKey(filespec))
            {
                TheHt.Add(filespec, m);
                IsDirty = true;
            }
        }
Exemplo n.º 2
0
        public void DumpHt()
        {
            var myEnumerator = TheHt.GetEnumerator();
            var i            = 0;

            Logger.Trace("\t-INDEX-\t-KEY-\t-VALUE-");
            while (myEnumerator.MoveNext())
            {
                Logger.Trace(string.Format("\t[{0}]:\t{1}\t{2}", i++, myEnumerator.Key, myEnumerator.Value));
            }
        }
Exemplo n.º 3
0
        public void PutPgm(PlayerGameMetrics pgm)
        {
            var key = string.Format("{0}:{1}", pgm.PlayerId, pgm.GameKey);

            if (this.TheHt.ContainsKey(key))
            {
                TheHt[key] = pgm;
            }
            else
            {
                TheHt.Add(key, pgm);
            }
            IsDirty = true;
        }
Exemplo n.º 4
0
        public void PutItem(TorrentItem m)
        {
            var title = m.Title;

            if (!TheHt.ContainsKey(title))
            {
                TheHt.Add(title, m);
                IsDirty = true;
                Logger.Trace($"    {title} added to HT");
            }
            else
            {
                Logger.Trace($"    {title} already in HT");
            }
        }
Exemplo n.º 5
0
        public void PutStat(YahooOutput stat)
        {
            if (stat.Quantity == 0.0M)
            {
                return;
            }

            IsDirty = true;
            if (TheHt.ContainsKey(stat.FormatKey()))
            {
                TheHt[stat.FormatKey()] = stat;
                return;
            }
            TheHt.Add(stat.FormatKey(), stat);
        }
Exemplo n.º 6
0
        public void PutItem(
            CountItem item)
        {
            var name = item.Name;

            if (!TheHt.ContainsKey(name))
            {
                TheHt.Add(
                    key: name,
                    value: item);
                IsDirty = true;
            }
            else
            {
                TheHt[name] = item;
            }
        }
Exemplo n.º 7
0
        public NflSeason GetSeason(string season, bool teamsOnly)
        {
            NflSeason s;

            if (TheHt.ContainsKey(season))
            {
                s = (NflSeason)TheHt[season];
                CacheHits++;
            }
            else
            {
                //  new it up
                s = new NflSeason(season, teamsOnly);
                PutSeason(s);
                CacheMisses++;
            }
            return(s);
        }
Exemplo n.º 8
0
        public NFLWeek GetWeek(string season, int week)
        {
            NFLWeek w;
            var     weekKey = string.Format("{0}:{1:0#}", season, week);

            if (TheHt.ContainsKey(weekKey))
            {
                w = (NFLWeek)TheHt[weekKey];
                CacheHits++;
            }
            else
            {
                w = new NFLWeek(int.Parse(season), week, loadGames: true);
                PutWeek(w);
                CacheMisses++;
            }
            return(w);
        }
Exemplo n.º 9
0
        public void PutRating(HillenPowerRating stat)
        {
            if (stat.Quantity == 0.0M)
            {
                return;
            }

            IsDirty = true;
            if (TheHt.ContainsKey(stat.FormatKey()))
            {
                TheHt[stat.FormatKey()] = stat;
#if DEBUG
                //Utility.Announce( string.Format( "HillenMaster:Putting Stat {0}", stat.FormatKey() ) );
#endif
                return;
            }
            TheHt.Add(stat.FormatKey(), stat);
#if DEBUG
            //Utility.Announce( string.Format( "HillenMaster:Adding Stat {0}", stat.FormatKey() ) );
#endif
        }
Exemplo n.º 10
0
        public override decimal GetStat(string theKey)
        {
            var season   = theKey.Substring(0, 4);
            var week     = theKey.Substring(5, 2);
            var playerId = theKey.Substring(8, 8);

            var stat = new YahooOutput
            {
                Season   = season,
                Week     = week,
                PlayerId = playerId,
                Quantity = 0.0M
            };

            Announce($"StatMaster:Getting Stat {stat.FormatKey()}");
            var testStat = "2017:05:WATSDE02";

            if (testStat == stat.FormatKey())
            {
                Announce($"StatMaster:Test Stat {stat.FormatKey()}");
            }

            var key = stat.FormatKey();

            if (TheHt.ContainsKey(key))
            {
                stat = ( YahooOutput )TheHt[key];
                CacheHits++;
            }
            else
            {
                //  new it up
                Announce($"StatMaster:Instantiating Stat {stat.FormatKey()}");
                PutStat(stat);
                IsDirty = true;
                CacheMisses++;
            }
            return(stat.Quantity);
        }
Exemplo n.º 11
0
        /// <summary>
        ///   Converts the memory hash table to XML
        /// </summary>
        public void Dump2Xml()
        {
            if ((TheHt.Count > 0) && IsDirty)
            {
                XmlTextWriter writer = new
                                       XmlTextWriter(string.Format("{0}{1}", Utility.OutputDirectory(), Filename), null);

                writer.WriteStartDocument();
                writer.WriteComment("Comments: " + Name);
                writer.WriteStartElement("season-list");

                IDictionaryEnumerator myEnumerator = TheHt.GetEnumerator();
                while (myEnumerator.MoveNext())
                {
                    NflSeason s = (NflSeason)myEnumerator.Value;
                    WriteSeasonNode(writer, s);
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Close();
                RosterLib.Utility.Announce(string.Format("{0}{1} created.", Utility.OutputDirectory(), Filename));
            }
        }
Exemplo n.º 12
0
        public void Dump2Xml()
        {
            if ((TheHt.Count > 0) && IsDirty)
            {
                var writer = new
                             XmlTextWriter(string.Format("{0}{1}", Utility.OutputDirectory(), Filename), null);

                writer.WriteStartDocument();
                writer.WriteComment("Comments: " + Name);
                writer.WriteStartElement("team-list");

                var myEnumerator = TheHt.GetEnumerator();
                while (myEnumerator.MoveNext())
                {
                    var t = (NflTeam)myEnumerator.Value;
                    WriteTeamNode(writer, t);
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Close();
                Utility.Announce(Filename + " created");
            }
        }
Exemplo n.º 13
0
        public override decimal GetStat(string theKey)
        {
            var season   = theKey.Substring(0, 4);
            var week     = theKey.Substring(5, 2);
            var teamCode = theKey.Substring(8, 2);

            var stat = new HillenPowerRating
            {
                Season   = season,
                Week     = week,
                TeamCode = teamCode,
                Quantity = 0.0M
            };

#if DEBUG
            Utility.Announce(string.Format("HillenMaster:Getting Stat {0}", stat.FormatKey()));
#endif

            var key = stat.FormatKey();
            if (TheHt.ContainsKey(key))
            {
                stat = (HillenPowerRating)TheHt[key];
                CacheHits++;
            }
            else
            {
                //  new it up
#if DEBUG
                Utility.Announce(string.Format("HillenMaster:Instantiating Stat {0}", stat.FormatKey()));
#endif
                PutRating(stat);
                IsDirty = true;
                CacheMisses++;
            }
            return(stat.Quantity);
        }
Exemplo n.º 14
0
        public NFLPlayer GetPlayer(string playerId)
        {
            NFLPlayer p;

            if (TheHt.ContainsKey(playerId))
            {
                p = (NFLPlayer)TheHt[playerId];
                CacheHits++;
#if DEBUG
                //RosterLib.Utility.Announce( "PlayerMaster.GetPlayer: Player " + playerId + " got from cache");
#endif
            }
            else
            {
                //  new it up
#if DEBUG
                //RosterLib.Utility.Announce( string.Format( "PlayerMaster.GetPlayer: Player {0} not in cache", playerId ));
#endif
                p = new NFLPlayer(playerId);
                PutPlayer(p);
                CacheMisses++;
            }
            return(p);
        }
Exemplo n.º 15
0
        public override decimal GetStat(string theKey)
        {
            var season   = theKey.Substring(0, 4);
            var week     = theKey.Substring(5, 2);
            var playerId = theKey.Substring(8, 8);

            var stat = new YahooOutput
            {
                Season   = season,
                Week     = week,
                PlayerId = playerId,
                Quantity = 0.0M
            };

#if DEBUG
//			Utility.Announce( string.Format( "StatMaster:Getting Stat {0}", stat.FormatKey() ) );
#endif

            var key = stat.FormatKey();
            if (TheHt.ContainsKey(key))
            {
                stat = (YahooOutput)TheHt[key];
                CacheHits++;
            }
            else
            {
                //  new it up
#if DEBUG
//				Utility.Announce( string.Format( "StatMaster:Instantiating Stat {0}", stat.FormatKey() ) );
#endif
                PutStat(stat);
                IsDirty = true;
                CacheMisses++;
            }
            return(stat.Quantity);
        }
Exemplo n.º 16
0
 public void AddPlayer(NFLPlayer p)
 {
     TheHt.Add(p.PlayerCode, p);
 }
Exemplo n.º 17
0
 void AddSeason(NflSeason s)
 {
     TheHt.Add(s.Year, s);
 }