Exemple #1
0
        //sets the value for a statistics type for a year
        public void setStatisticsValue(int year, StatisticsType type, double value)
        {
            StatisticsValue item = this.StatValues.Find(s => s.Year == year && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                this.StatValues.Add(new StatisticsValue(year, type, value));
            }
            else
            {
                item.Value = value;
            }
        }
Exemple #2
0
        //returns the total valu for a statistics type
        public double getStatisticsValue(StatisticsType type)
        {
            double value = 0;

            foreach (int year in this.StatValues.Keys)
            {
                StatisticsValue statValue = this.StatValues[year].Find(sv => sv.Stat == type);
                if (statValue != null)
                {
                    value += statValue.Value;
                }
            }
            return(value);
        }
Exemple #3
0
 //returns the value for a statistics type for a year
 public double getStatisticsValue(int year, StatisticsType type)
 {
     lock (this.StatValues)
     {
         if (this.StatValues.ContainsKey(year))
         {
             StatisticsValue value = this.StatValues[year].Find(sv => sv.Stat == type);
             if (value != null)
             {
                 return(value.Value);
             }
         }
         return(0);
     }
 }
Exemple #4
0
        //returns the value for a statistics type for a year
        public double getStatisticsValue(int year, StatisticsType type)
        {
            var stats = new List <StatisticsValue>(this.StatValues);

            StatisticsValue item = stats.FirstOrDefault(s => s.Stat != null && s.Year == year && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                return(0);
            }
            else
            {
                return(item.Value);
            }
        }
Exemple #5
0
 //sets the value for a statistics type for a year
 public void setStatisticsValue(int year, StatisticsType type, double value)
 {
     lock (this.StatValues)
     {
         if (!this.StatValues.ContainsKey(year))
         {
             this.StatValues.Add(year, new List <StatisticsValue>());
         }
         StatisticsValue statValue = this.StatValues[year].Find(sv => sv.Stat == type);
         if (statValue != null)
         {
             statValue.Value = value;
         }
         else
         {
             this.StatValues[year].Add(new StatisticsValue(type, value));
         }
     }
 }