コード例 #1
0
        public NflStat GetStat(string season, string week, string teamCode, string statType)
        {
            var stat = new NflStat
            {
                Season   = season,
                TeamCode = teamCode,
                Week     = week,
                StatType = statType,
                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 = (NflStat)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);
        }
コード例 #2
0
ファイル: StatMaster.cs プロジェクト: Quarterback16/GerardGui
        public NflStat GetStat( string season, string week, string teamCode, string statType )
        {
            var stat = new NflStat
                       	{
                       		Season = season,
                                TeamCode = teamCode,
                                Week = week,
                                StatType = statType,
                                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 = (NflStat) 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;
        }
コード例 #3
0
 private static void WriteStatNode(XmlWriter writer, NflStat stat)
 {
     writer.WriteStartElement("stat");
     writer.WriteAttributeString("season", stat.Season);
     writer.WriteAttributeString("week", stat.Week);
     writer.WriteAttributeString("team", stat.TeamCode);
     writer.WriteAttributeString("statType", stat.StatType);
     writer.WriteAttributeString("qty", stat.Quantity.ToString());
     writer.WriteAttributeString("opp", stat.Opponent);
     writer.WriteEndElement();
 }
コード例 #4
0
        public void PutStat(NflStat stat)
        {
            if (stat.Quantity == 0.0M)
            {
                return;
            }

            IsDirty = true;
            if (TheHt.ContainsKey(stat.FormatKey()))
            {
                TheHt[stat.FormatKey()] = stat;
                return;
            }
            TheHt.Add(stat.FormatKey(), stat);
        }
コード例 #5
0
ファイル: StatMaster.cs プロジェクト: Quarterback16/GerardGui
 private static void WriteStatNode( XmlWriter writer, NflStat stat )
 {
     writer.WriteStartElement( "stat" );
     writer.WriteAttributeString( "season", stat.Season );
     writer.WriteAttributeString( "week", stat.Week );
     writer.WriteAttributeString( "team", stat.TeamCode );
     writer.WriteAttributeString( "statType", stat.StatType );
     writer.WriteAttributeString( "qty", stat.Quantity.ToString() );
     writer.WriteAttributeString( "opp", stat.Opponent );
     writer.WriteEndElement();
 }
コード例 #6
0
ファイル: StatMaster.cs プロジェクト: Quarterback16/GerardGui
        public void PutStat( NflStat stat )
        {
            if ( stat.Quantity == 0.0M ) return;

            IsDirty = true;
            if ( TheHt.ContainsKey( stat.FormatKey() ) )
            {
                TheHt[ stat.FormatKey() ] = stat;
                return;
            }
            TheHt.Add( stat.FormatKey(), stat );
        }